fix: error is returned if brackets are unmatched

master
Serge A. Zaitsev 13 years ago
parent f3b41ae30c
commit af04595fe2

@ -161,6 +161,8 @@ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, jsmntok_t *tokens,
break; break;
} }
} }
/* Error if unmatched closing bracket */
if (i == -1) return JSMN_ERROR_INVAL;
for (; i >= 0; i--) { for (; i >= 0; i--) {
token = &tokens[i]; token = &tokens[i];
if (token->start != -1 && token->end == -1) { if (token->start != -1 && token->end == -1) {

Loading…
Cancel
Save