Closed sthibaul closed 4 years ago
So I don't quite get it. The AddressSanitizer report says that you have a buffer overflow at line 537 where it says:
insertLength = inserts->charInserts[sumLength] - 1;
How is your patch helping to avoid this?
What happens here is that which
is equal to inserts->numInserts
. And thus the for (k)
loop before that line will iterate over the whole inserts
chain, before that line tryies to access insert index which
, thus exactly outside the array.
which
being equal to inserts->numInserts
is an error anyway, so 1 should just be returned in that case, just like the existing test does for the specific case where inserts->numInserts
happens to be just 1.
"which" should can not be equal to the number of inserts.
The issue was detected by using CFLAGS=-fsanitize=address while running test_mathml_woluwe/test_089.test and test_mathml_woluwe/test_097.test: