nftables/backport-evaluate-bogus-datatype-assertion-in-binary-operation-evaluation.patch
2023-03-24 14:10:12 +08:00

37 lines
1.2 KiB
Diff

From 77bd7e0c70d9a1914c4a853e09849af724c0f695 Mon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Wed, 5 Oct 2022 01:36:44 +0200
Subject: [PATCH] evaluate: bogus datatype assertion in binary operation
evaluation
Use datatype_equal(), otherwise dynamically allocated datatype fails
to fulfill the datatype pointer check, triggering the assertion:
nft: evaluate.c:1249: expr_evaluate_binop: Assertion `expr_basetype(left) == expr_basetype(right)' failed.
Conflict: Remove supplementary test cases
Reference: https://git.netfilter.org/nftables/commit?id=77bd7e0c70d9a1914c4a853e09849af724c0f695
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1636
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/evaluate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/evaluate.c b/src/evaluate.c
index f1f4926..a4047dc 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1215,7 +1215,7 @@ static int expr_evaluate_binop(struct eval_ctx *ctx, struct expr **expr)
sym, expr_name(right));
/* The grammar guarantees this */
- assert(expr_basetype(left) == expr_basetype(right));
+ assert(datatype_equal(expr_basetype(left), expr_basetype(right)));
switch (op->op) {
case OP_LSHIFT:
--
2.33.0