0
0
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:
Eliot Horowitz 2009-12-08 15:14:00 -05:00
parent 6c1f48d46f
commit 3b6ad70940

View File

@ -178,9 +178,9 @@ bool isBalanced( string code ){
}
continue;
case '{': brackets++; break;
case '}': brackets--; break;
case '}': if ( brackets <= 0 ) return true; brackets--; break;
case '(': parens++; break;
case ')': parens--; break;
case ')': if ( parens <= 0 ) return true; parens--; break;
case '"':
i++;
while ( i < code.size() && code[i] != '"' ) i++;