Memory access error with JSMN_PARENT_LINKS switch and erroneous input string

Issue #43 new
Anonymous created an issue

The following code could access the tokens array at index '-1' if the input string is erroneous (eg. ",")

jsmn.c:247:

parser->toksuper = tokens[parser->toksuper].parent;

Comments (4)

  1. jose maria

    Is there any reason why this pull request hasn't been merged yet? I just run into the same issue, causing CPU trap on my embedded system due to illegal memory access. Would be great to have this fix in mainline!

  2. Log in to comment