Closed IAXES closed 8 years ago
What I have to say about it:
jsmn_parser
for null since it's just 3 ints which is normally going to be allocated on stack.jsmn_parser
would be passed uninitialized nothing bad would happen anyway since jsmn_parse()
would die in beginning of for
loop if pos > len
OR after calling jsmn_alloc_token()
if toknext > num_tokens.jsmn_parse()
already has return codes and jsmn_init()
has literally nothing to return. Rest are static functions.Sounds fair enough. Closing.
If the client application doesn't properly initialize the context variable (ie:
jsmn_parser p
), the various API functions will potentially issue indirection operations on invalid/NULL pointers. I think this code would benefit from additional sanity checks at the beginning of each function, and changing the API a little bit (ie: novoid
functions, everything has a return code).Do you have any concerns with this? If it sounds reasonable, I can put the changes in place easily enough, and have a pull request available fairly soon.