diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-12-08 15:14:00 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-12-08 15:14:00 -0500 |
commit | 3b6ad7094099ccc25697ceb403f20df88bd4f180 (patch) | |
tree | a51682fdbf1eda91693ea6aadb6537ebf63ce500 /shell | |
parent | 6c1f48d46f608358245263106a0f91eaca433aef (diff) | |
download | mongo-3b6ad7094099ccc25697ceb403f20df88bd4f180.tar.gz |
fail faster on crappy input
Diffstat (limited to 'shell')
-rw-r--r-- | shell/dbshell.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp index 93d5828a5d0..6f5df237176 100644 --- a/shell/dbshell.cpp +++ b/shell/dbshell.cpp @@ -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++; |