swscale/format: add assertion to guard UB

AVRational still can't handle 32-bit values...

Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
Niklas Haas
2026-02-21 15:45:58 +01:00
committed by Niklas Haas
parent d4202809da
commit ecb707f7e0

View File

@@ -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);