All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 2/4] evaluate: validate set expression type before accessing flags
Date: Wed,  9 Jul 2025 01:23:52 +0200	[thread overview]
Message-ID: <20250708232354.2189045-3-pablo@netfilter.org> (raw)
In-Reply-To: <20250708232354.2189045-1-pablo@netfilter.org>

Validate set->init is of EXPR_SET before accessing set_flags.

Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/evaluate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 83381b4ef3d0..f4f72ee4a4f7 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -5290,7 +5290,8 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
 		set->flags |= NFT_SET_EXPR;
 
 	if (set_is_anonymous(set->flags)) {
-		if (set_is_interval(set->init->set_flags) &&
+		if (set->init->etype == EXPR_SET &&
+		    set_is_interval(set->init->set_flags) &&
 		    !(set->init->set_flags & NFT_SET_CONCAT) &&
 		    interval_set_eval(ctx, set, set->init) < 0)
 			return -1;
-- 
2.30.2


  parent reply	other threads:[~2025-07-08 23:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 23:23 [PATCH nft 0/4] detach concat, list and set expression layouts Pablo Neira Ayuso
2025-07-08 23:23 ` [PATCH nft 1/4] evaluate: mappings require set expression Pablo Neira Ayuso
2025-07-08 23:23 ` Pablo Neira Ayuso [this message]
2025-07-08 23:23 ` [PATCH nft 3/4] src: convert set to list expression Pablo Neira Ayuso
2025-07-08 23:23 ` [PATCH nft 4/4] src: detach set, list and concatenation expression layout Pablo Neira Ayuso
2025-07-09 13:58 ` [PATCH nft 0/4] detach concat, list and set expression layouts Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250708232354.2189045-3-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.