Subject: | Malformed strings send parser into an endless loop |
If e.g. the user misquotes a value as
foo = "bar'
the parser gets stuck in an endless loop.
Minimal example:
perl -MTOML -E'say "ok" if from_toml("foo = \"bar'"'"'")'
This is because you assume that one of the s/// regexes for the various
constructs wil always match and thus shorten the string, but this syntax
error (and a whole bunch of other possibilities) prevent this from
happening.
One solution would be to save the current string at the top of the loop
and at the bottom check whether the length has changed. If not, a syntax
error must be on the current line.