]> granicus.if.org Git - onig/commitdiff
fix #121: Miss null pointer check
authorK.Kosako <kosako@sofnec.co.jp>
Thu, 27 Sep 2018 04:39:08 +0000 (13:39 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Thu, 27 Sep 2018 04:39:08 +0000 (13:39 +0900)
src/regparse.c

index 25258c4457269928b9c4dcf518b85eda2be620cc..d95bdad65c2ca23dccb8d4173ac09061cc1da8b9 100644 (file)
@@ -7713,8 +7713,9 @@ parse_exp(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
   case TK_ALT:
   case TK_EOT:
   end_of_token:
-  *np = node_new_empty();
-  return tok->type;
+    *np = node_new_empty();
+    CHECK_NULL_RETURN_MEMERR(*np);
+    return tok->type;
   break;
 
   case TK_SUBEXP_OPEN:
@@ -7965,8 +7966,10 @@ parse_exp(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
     if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS)) {
       if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS))
         return ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED;
-      else
+      else {
         *np = node_new_empty();
+        CHECK_NULL_RETURN_MEMERR(*np);
+      }
     }
     else {
       goto tk_byte;