aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2025-07-28 20:45:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2025-07-30 01:18:02 +0200
commit3ccd7d8c8e85aaae0c6d6cc88ea6cb5309d56cdc (patch)
treeaa4ace9d10ec2472fd8594f02fdcb18d385cd1f3
parent5f24c50890c686c91b609e83a2b67e16bb504b07 (diff)
downloadffmpeg-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.c5
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;