[FFmpeg-cvslog] avcodec/sanm: Check decoded_size for old_codec48
Michael Niedermayer
git at videolan.org
Wed Jul 30 02:26:19 EEST 2025
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jul 28 20:45:59 2025 +0200| [3ccd7d8c8e85aaae0c6d6cc88ea6cb5309d56cdc] | committer: Michael Niedermayer
avcodec/sanm: Check decoded_size for old_codec48
Fixes: writing over the end of the array
Fixes: BIGSLEEP-434637586/payload
Regression since: b22ce90d42
Found-by: Google Big Sleep
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ccd7d8c8e85aaae0c6d6cc88ea6cb5309d56cdc
---
libavcodec/sanm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 02bb78859a..617b977ab7 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -1601,6 +1601,11 @@ static int old_codec48(SANMVideoContext *ctx, int width, int height)
}
break;
case 2:
+ if (decoded_size > ctx->buf_size) {
+ av_log(ctx->avctx, AV_LOG_ERROR, "Decoded size %u is too large.\n", decoded_size);
+ return AVERROR_INVALIDDATA;
+ }
+
if (rle_decode(ctx, &ctx->gb, dst, decoded_size))
return AVERROR_INVALIDDATA;
break;
More information about the ffmpeg-cvslog
mailing list