]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: flt-decomp: Don't instantiate a filter without applicable direction
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 5 Oct 2026 14:53:37 +0000 (16:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 9 Oct 2026 14:17:35 +0000 (16:17 +0200)
decomp_strm_init() asserted that the filter configuration was never
NULL. This holds for the legacy filter configurations, which always carry
the decompression direction of their proxy. But an implicit instance
inherited by a proxy without the matching capability will keep its metadata
while having no applicable direction, leaving its configuration NULL when
the instance is finalized.

Drop the assertion and handle a NULL configuration like a direction disabled
with the "none" mode or without any algorithm: the filter is not attached to
the stream and the instance remains as metadata. The decompression behavior
is unchanged, such a filter was already ignored on every stream.

src/flt_decomp.c

index a7d085385776522d0cb9d43bc8cf161bde20ecb5..16b4c1a7e0145c4cf0ee5c744750a7cdb0df8a8b 100644 (file)
@@ -65,9 +65,10 @@ decomp_strm_init(struct stream *s, struct filter *filter)
        struct decomp_dir *decomp_dir = FLT_CONF(filter);
        struct decomp_state *st;
 
-       BUG_ON(!decomp_dir);
-
-       if ((decomp_dir->flags & DECOMP_DIR_FL_MODE_NONE) || !decomp_dir->algos)
+       /* An implicit instance inherited by an incompatible proxy has no
+        * applicable direction. Keep its metadata, but do not instantiate it.
+        */
+       if (!decomp_dir || (decomp_dir->flags & DECOMP_DIR_FL_MODE_NONE) || !decomp_dir->algos)
                return 0;
 
        st = pool_alloc(pool_head_decomp_state);