mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
fail faster on crappy input
This commit is contained in:
parent
6c1f48d46f
commit
3b6ad70940
@ -178,9 +178,9 @@ bool isBalanced( string code ){
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
case '{': brackets++; break;
|
case '{': brackets++; break;
|
||||||
case '}': brackets--; break;
|
case '}': if ( brackets <= 0 ) return true; brackets--; break;
|
||||||
case '(': parens++; break;
|
case '(': parens++; break;
|
||||||
case ')': parens--; break;
|
case ')': if ( parens <= 0 ) return true; parens--; break;
|
||||||
case '"':
|
case '"':
|
||||||
i++;
|
i++;
|
||||||
while ( i < code.size() && code[i] != '"' ) i++;
|
while ( i < code.size() && code[i] != '"' ) i++;
|
||||||
|
Loading…
Reference in New Issue
Block a user