summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2025-03-10 08:29:37 +0100
committerFlorian Westphal <fw@strlen.de>2025-03-10 10:31:17 +0100
commitf6d9610c86ce6f1b8618611e3c993970760bc03d (patch)
tree93da8063c0b60010f0c77dcce4a55565fdf85ccf /src
parent47c4a5ddbb466da165c039de6eefb955509b6439 (diff)
evaluate: don't crash if range has same start and end interval
In this case, evaluation step replaces the range expression with a single value and we'd crash as range->left/right contain garbage values. Simply replace the input expression with the evaluation result. Also add a test case modeled on the afl reproducer. Fixes: fe6cc0ad29cd ("evaluate: consolidate evaluation of symbol range expression") Signed-off-by: Florian Westphal <fw@strlen.de> Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/evaluate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index e27d08ce..722c11a2 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2351,6 +2351,10 @@ static int expr_evaluate_symbol_range(struct eval_ctx *ctx, struct expr **exprp)
expr_free(range);
return -1;
}
+
+ if (range->etype != EXPR_RANGE)
+ goto out_done;
+
left = range->left;
right = range->right;
@@ -2371,6 +2375,7 @@ static int expr_evaluate_symbol_range(struct eval_ctx *ctx, struct expr **exprp)
return 0;
}
+out_done:
expr_free(expr);
*exprp = range;