Open NotmebutWind opened 2 years ago
Thank you for the report, and sorry for the late response. By design, this library doesn't make much account of too complex input. To solve this problem, we won't be able to use stack based algorithm for parsing. It is possible, however, I believe it will cause code complex, and it's beyond this library's purpose.
Hi,
I have found a bug when I fuzzing . When I enter an input file to a program use toml.h with parseFile, it cause a stack-overflow at parseFile function. I think there maybe too much loop or other bug cause this . my stack size is 8192kbs.
I know that we can avoid it by ulimit -s , but I think parse a toml file about 32k that cause 8M stack overflow maybe not a good way. If I make a file follow some pattern , the file may be minimized and smaller than 10k.
Here is the backtrace:
(and maybe 20000 times repeat below two lines)
and this below:
the testcase I use is like parse_file.cc in your project. you can just compile use your code and input my file to the parse_file. stack size is 8192kbs. And you will get a segment fault caused by stack overflow. I have upload the file causes this. crashcase.zip