Commit 2c25d197 authored by Adam Reichold's avatar Adam Reichold Committed by Albert Astals Cid

Remove index out of range assertions from Array getters

A lot of code seems to have been incompatible with the recently removed DEBUG_MEM
flag, i.e. it relied on the Array getters returning a null object when the index
was out of range and rather checked the returned object type (since they had to do
that in any case) than the index.

Due to this, debug builds became much harder to test, especially using fuzzing. This
commit thereby removes the assertions to restore the situation when DEBUG_MEM was
present but disabeld by default and should thereby fix oss-fuzz/10121.
parent 987bbb68
......@@ -107,7 +107,6 @@ void Array::add(Object &&elem) {
void Array::remove(int i) {
arrayLocker();
if (i < 0 || i >= length) {
assert(i >= 0 && i < length);
return;
}
--length;
......@@ -116,7 +115,6 @@ void Array::remove(int i) {
Object Array::get(int i, int recursion) const {
if (i < 0 || i >= length) {
assert(i >= 0 && i < length);
return Object(objNull);
}
return elems[i].fetch(xref, recursion);
......@@ -124,7 +122,6 @@ Object Array::get(int i, int recursion) const {
Object Array::getNF(int i) const {
if (i < 0 || i >= length) {
assert(i >= 0 && i < length);
return Object(objNull);
}
return elems[i].copy();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment