Closed lunatikub closed 5 years ago
@chlunde Fixed !
Any news ?
@lunatikub
I am using your patch in our project here:
https://github.com/fluent/fluent-bit/tree/master/lib/jsmn
I've found that when running in strict mode and tokens is NULL (because I want only to validate the string and not to populate results), the validation fails, a simple JSON map input like this helps to reproduce the problem:
{"key": "some value"}
e.g:
ret = jsmn_parse(&parser, json, len, NULL, 0);
any hints are appreciated.
Hi @edsiper,
Thanks for highlighting this important point in my patch:
The strict mode needs the array of tokens to validate a JSON: in the case of a string token, its needs to know the type of the parent to deduce the type of the next token by the function 'jsmn_string_next_tok'.
For instance, if a string is being parsed and the parent is an 'array', the next type after a comma must be a 'value'.
With this point in mind, I will modify the patch so that passing a NULL 'tokens' array will not be accepted by the function 'jsmn_parse'.
It will look like: `#ifdef JSMN_STRICT assert(tokens != NULL);
Warm regards, Thomas,
@lunatikub thanks for the detailed info, that makes a lot of sense, I will go ahead and deprecate the usage of jsmn_parse() in that mode.
btw, have you consider to maintain a fork of this project since it low activity from a maintainer perspective ?
More changes ahead.
add more strict checking