* [nft PATCH] intervals: Fix for inconsistent union field use
@ 2026-06-03 18:47 Phil Sutter
2026-06-17 16:03 ` Phil Sutter
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2026-06-03 18:47 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Reported by a static code analyzer: key->value belongs to a different
struct in the embedded anonymous union than key->range.* which is
accessed elsewhere in that function.
It is correct in that the function asserts key->etype to be
EXPR_RANGE_VALUE, so key->value is not necessarily valid (it just
happens to match key->range.low's offset.
Fixes: 91dc281a82ea6 ("src: rework singleton interval transformation to reduce memory consumption")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
src/intervals.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/intervals.c b/src/intervals.c
index c9e278b2a895a..d6af7cbc144ec 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -832,7 +832,8 @@ int setelem_to_interval(const struct set *set, struct expr *elem,
if (adjacent)
return 0;
- else if (!mpz_cmp_ui(key->value, 0) && elem->key->flags & EXPR_F_INTERVAL_END) {
+ else if (!mpz_cmp_ui(key->range.low, 0) &&
+ elem->key->flags & EXPR_F_INTERVAL_END) {
low->key->flags |= EXPR_F_INTERVAL_END;
return 0;
} else if (mpz_scan0(key->range.high, 0) == set->key->len) {
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [nft PATCH] intervals: Fix for inconsistent union field use
2026-06-03 18:47 [nft PATCH] intervals: Fix for inconsistent union field use Phil Sutter
@ 2026-06-17 16:03 ` Phil Sutter
0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2026-06-17 16:03 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On Wed, Jun 03, 2026 at 08:47:15PM +0200, Phil Sutter wrote:
> Reported by a static code analyzer: key->value belongs to a different
> struct in the embedded anonymous union than key->range.* which is
> accessed elsewhere in that function.
>
> It is correct in that the function asserts key->etype to be
> EXPR_RANGE_VALUE, so key->value is not necessarily valid (it just
> happens to match key->range.low's offset.
>
> Fixes: 91dc281a82ea6 ("src: rework singleton interval transformation to reduce memory consumption")
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Patch applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-17 16:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 18:47 [nft PATCH] intervals: Fix for inconsistent union field use Phil Sutter
2026-06-17 16:03 ` Phil Sutter
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.