jsmn
jsmn copied to clipboard
JSON validation escapes with JSMN_STRICT
When using JSMN_STRICT, some cases of invalid JSON are not caught. The following JSON's are parsed as valid.
{"a"}
{"a":1,"b"}
{"a","b":1}
{"a":1,}
{"a":"b":"c"}
{,}
(any number of ",")
There may be more examples.
- Bitbucket: https://bitbucket.org/zserge/jsmn/issue/52
- Originally reported by: matthewb_gc
- Originally created at: 2015-07-22T14:31:42.617
Hello Serge,
Have you had a chance to investigate this issue? Should I re-open this issue in the new github repo?
Thank you
Original comment by: matthewb_gc
I suspect the best way to handle this is a simple state machine built in to the parser.
According to this answer http://stackoverflow.com/a/22361229/6742459 the first one {"a"}
is valid for RFC-7159 but invalid for RFC-4627.