avcodec/notchlc: Check 255 loops

Fixes: integer overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 05817dc7dd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-04-28 13:41:15 +02:00
parent d84bec2bd6
commit 5d24736758
+4
View File
@@ -88,6 +88,8 @@ static int lz4_decompress(AVCodecContext *avctx,
unsigned char current;
do {
current = bytestream2_get_byte(gb);
if (current > INT_MAX - num_literals)
return AVERROR_INVALIDDATA;
num_literals += current;
} while (current == 255);
}
@@ -120,6 +122,8 @@ static int lz4_decompress(AVCodecContext *avctx,
do {
current = bytestream2_get_byte(gb);
if (current > INT_MAX - match_length)
return AVERROR_INVALIDDATA;
match_length += current;
} while (current == 255);
}