detect malformed comments

mutable-v2
Antonio Cervone 2015-11-30 12:40:20 +01:00
parent b05e655c0a
commit 2f5c64225d
1 changed files with 7 additions and 2 deletions

View File

@ -383,11 +383,16 @@ struct JsonParser {
else if (str[i] == '*') { // multiline comment else if (str[i] == '*') { // multiline comment
i++; i++;
// advance until closing tokens // advance until closing tokens
while (!(str[i] == '*' && str[i+1] == '/')) while (!(str[i] == '*' && str[i+1] == '/')) {
i++; if (i == str.size())
return fail(
"unexpected end of input inside multi-line comment", 0);
i++;}
i += 2; i += 2;
comment_found = true; comment_found = true;
} }
else
return fail("malformed comment", 0);
} }
return comment_found; return comment_found;
} }