aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-07-05 02:21:56 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-07-12 22:42:46 +0200
commit0474614e6cf8edcd0077b95772c29fae894a7db9 (patch)
tree44cfc6b28beaee828e3760874447c40cc29bf980 /libavcodec
parentf18b442370d714b930e3e983c2e5d789229f3356 (diff)
downloadffmpeg-0474614e6cf8edcd0077b95772c29fae894a7db9.tar.gz
avcodec/pixlet: Simplify pfx computation
Found by reviewing code related to CID1604365 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pixlet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 6b6e39f275..e9c561d70d 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -231,8 +231,8 @@ static int read_high_coeffs(AVCodecContext *avctx, const uint8_t *src, int16_t *
if (cnt1 >= length) {
cnt1 = get_bits(bc, nbits);
} else {
- pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14));
- if (pfx < 1 || pfx > 25)
+ pfx = FFMIN(value, 14);
+ if (pfx < 1)
return AVERROR_INVALIDDATA;
cnt1 *= (1 << pfx) - 1;
shbits = show_bits(bc, pfx);