From 05817dc7dd269bcdb9ded330d0bbfb70511697a9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 28 Apr 2026 13:41:15 +0200 Subject: [PATCH] avcodec/notchlc: Check 255 loops Fixes: integer overflow Signed-off-by: Michael Niedermayer --- libavcodec/notchlc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c index c28fddcea0..396089254e 100644 --- a/libavcodec/notchlc.c +++ b/libavcodec/notchlc.c @@ -90,6 +90,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); } @@ -122,6 +124,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); }