Open tysonite opened 3 years ago
The library kinds of expect the input to be at least a little bit correct :)
Still, it should just return -EIO
instead of segfaulting...
I think the problem might be that on line 160 the ini->curr
pointer is increased and on line 162 it is increased again, so if the last character in the string is [
, it will read past the end of the input.
If that is indeed the problem, a possible fix would be to replace ++ini->curr
by ini->curr + 1
on line 160.
I was just interested to play with AFL fuzzer on some library. Instrumented and run libini's example under AFL, there were few crashes for inputs below.
Inputs:
Core dump might be reproduced by running
example/test <input>.txt
.The back trace looks like that: