From ecb707f7e075dc550ae0bbfd0b6bd0b4778854ce Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 21 Feb 2026 15:45:58 +0100 Subject: [PATCH] swscale/format: add assertion to guard UB AVRational still can't handle 32-bit values... Signed-off-by: Niklas Haas --- libswscale/format.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libswscale/format.c b/libswscale/format.c index 10cecc8ae4..56f9e53447 100644 --- a/libswscale/format.c +++ b/libswscale/format.c @@ -1097,6 +1097,7 @@ static SwsLinearOp fmt_encode_range(const SwsFormat *fmt, bool *incomplete) if (fmt->desc->flags & AV_PIX_FMT_FLAG_FLOAT) return c; /* floats are directly output as-is */ + av_assert0(depth0 < 32 && depth1 < 32 && depth2 < 32 && depth3 < 32); if (fmt->csp == AVCOL_SPC_RGB || (fmt->desc->flags & AV_PIX_FMT_FLAG_XYZ)) { c.m[0][0] = Q((1 << depth0) - 1); c.m[1][1] = Q((1 << depth1) - 1);