diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2025-07-28 20:45:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2025-07-30 01:18:02 +0200 |
commit | 3ccd7d8c8e85aaae0c6d6cc88ea6cb5309d56cdc (patch) | |
tree | aa4ace9d10ec2472fd8594f02fdcb18d385cd1f3 | |
parent | 5f24c50890c686c91b609e83a2b67e16bb504b07 (diff) | |
download | ffmpeg-3ccd7d8c8e85aaae0c6d6cc88ea6cb5309d56cdc.tar.gz |
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@niedermayer.cc>
-rw-r--r-- | libavcodec/sanm.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |