From b679b0a3e8ac54570e285281da43e7fa2c861ebd Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 22 Oct 2023 21:23:03 +0200 Subject: Fortify the parsing of hexadecimal definitions. --- src/analysis/scan/grammar.y | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y index f603c85..02e5973 100644 --- a/src/analysis/scan/grammar.y +++ b/src/analysis/scan/grammar.y @@ -788,6 +788,7 @@ YY_DECL; } | "~" hex_token { + if ($2 == NULL) YYERROR; $$ = g_scan_token_node_not_new($2); } @@ -845,6 +846,9 @@ YY_DECL; hex_choices : hex_token "|" hex_token { + if ($1 == NULL) YYERROR; + if ($3 == NULL) YYERROR; + $$ = g_scan_token_node_choice_new(); g_scan_token_node_choice_add(G_SCAN_TOKEN_NODE_CHOICE($$), $1); g_object_unref(G_OBJECT($1)); @@ -853,6 +857,8 @@ YY_DECL; } | hex_choices "|" hex_token { + if ($3 == NULL) YYERROR; + $$ = $1; g_scan_token_node_choice_add(G_SCAN_TOKEN_NODE_CHOICE($$), $3); g_object_unref(G_OBJECT($3)); -- cgit v0.11.2-87-g4458