zserge / jsmn

Jsmn is a world fastest JSON parser/tokenizer. This is the official repo replacing the old one at Bitbucket
MIT License
3.65k stars 778 forks source link

handles unterminated strings #168

Open feiyax opened 5 years ago

feiyax commented 5 years ago

This change helps cases where a string starts with a quotation but without a quotation at its end in non-strict mode.

With this change, a string will end upon encountering unescaped quotation mark or unescaped line feed.


Without this change, the JSMN behaves inconsistently for such cases in non-strict mode, as explained below.


I used the following json snippets to test before and after this change.

{
    "first": "good",
    "middle": "bad
    "last": "good"
}
{
    "first": "good",
    "middle": "good",
    "last": "bad
}

(please go easy on me; this is my first PR)