From 08c90c60f7562301858f1bdf06e6bc8abd3ec878 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 21 Jun 2026 16:51:03 +0200 Subject: [PATCH] swscale/ops: fix merge_comp_flags() for SWS_COMP_SWAPPED This violates the documentation (monoid property). It's a bit arbitrary whether to consider this an OR-type or AND-type flag, since mixing swapped and non-swapped components is almost surely a bug, but keeping it as an OR-type makes sure such cases at least show up in the result. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/ops.c b/libswscale/ops.c index 0582a32345..1f555e9479 100644 --- a/libswscale/ops.c +++ b/libswscale/ops.c @@ -281,7 +281,7 @@ enum { /* merge_comp_flags() forms a monoid with SWS_COMP_IDENTITY as the null element */ static SwsCompFlags merge_comp_flags(SwsCompFlags a, SwsCompFlags b) { - const SwsCompFlags flags_or = SWS_COMP_GARBAGE; + const SwsCompFlags flags_or = SWS_COMP_GARBAGE | SWS_COMP_SWAPPED; const SwsCompFlags flags_and = SWS_COMP_IDENTITY; return ((a & b) & flags_and) | ((a | b) & flags_or); }