about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-07 17:23:52 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-07 17:23:52 +0000
commit1391a42343d7a597b9ee413551ba013218d21b8c (patch)
tree0879ec3d03fbfae0a27e506c8ca0f993489c914e /lib
parent5ff59927c677a32bc728462ba00300264c6ad9ae (diff)
downloadklee-1391a42343d7a597b9ee413551ba013218d21b8c.tar.gz
Diagnose some more syntax errors instead of crashing.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Expr/Parser.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp
index f6487674..a5c6123f 100644
--- a/lib/Expr/Parser.cpp
+++ b/lib/Expr/Parser.cpp
@@ -589,6 +589,12 @@ DeclResult ParserImpl::ParseQueryCommand() {
     return DeclResult();
   }
 
+  if (Tok.kind != Token::LSquare) {
+    Error("malformed query, expected expression list.");
+    SkipUntilRParen();
+    return DeclResult();
+  }
+
   ConsumeLSquare();
   // FIXME: Should avoid reading past unbalanced parens here.
   while (Tok.kind != Token::RSquare) {
@@ -611,6 +617,12 @@ DeclResult ParserImpl::ParseQueryCommand() {
   // Return if there are no optional lists of things to evaluate.
   if (Tok.kind == Token::RParen)
     goto exit;
+
+  if (Tok.kind != Token::LSquare) {
+    Error("malformed query, expected expression list.");
+    SkipUntilRParen();
+    return DeclResult();
+  }
   
   ConsumeLSquare();
   // FIXME: Should avoid reading past unbalanced parens here.