]> sourceware.org Git - systemtap.git/commitdiff
Added null-checks to parser
authorRyan Goldberg <rgoldber@redhat.com>
Thu, 19 Jan 2023 19:30:18 +0000 (14:30 -0500)
committerRyan Goldberg <rgoldber@redhat.com>
Fri, 3 Feb 2023 16:08:56 +0000 (11:08 -0500)
parse.cxx

index 912ce65e57e8951adb713a6f8514584551816337..3fe2d921d7e5f2fdc8d535c590aaaf606ff61cf3 100644 (file)
--- a/parse.cxx
+++ b/parse.cxx
@@ -2073,7 +2073,7 @@ parser::parse_synthetic_probe (const token* chain)
 
   input.set_current_file(0);
   input.set_current_token_chain(0);
-  p->synthetic = true;
+  if(p) p->synthetic = true;
   return p;
 }
 
@@ -2521,6 +2521,8 @@ parser::do_parse_functiondecl (vector<functiondecl*>& functions, const token* t,
     }
 
   t = peek();
+  if(!t)
+    throw PARSE_ERROR (_("expected '{'"));
   if (t->type == tok_operator && t->content == ":")
     {
       swallow();
@@ -2919,6 +2921,8 @@ parser::parse_return_statement ()
   s->tok = t;
 
   t = peek ();
+  if(!t)
+    throw PARSE_ERROR (_("expected ';', '}' or an expression statement"));
   if (t->type == tok_operator && (t->content == ";" || t->content == "}"))
     s->value = NULL;  // no return value
   else
This page took 0.031256 seconds and 5 git commands to generate.