summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-10-22 19:23:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-10-22 19:23:03 (GMT)
commitb679b0a3e8ac54570e285281da43e7fa2c861ebd (patch)
tree160c42c04b3f42d09c77e0b0ded966a67fa6b3a2 /src/analysis
parentc74d1a9d8f1430b4e4f3989b12b9953cbb8fed50 (diff)
Fortify the parsing of hexadecimal definitions.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/scan/grammar.y6
1 files changed, 6 insertions, 0 deletions
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));