aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-09-19 23:57:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-09-24 15:37:17 +0200
commitc3a1cbbf5d99337b5e99260eb95c84e65c7587f6 (patch)
treef6a84afebaaf1b3a23443786a3e45db5ba1a5cb2
parent9a823fbcfae33c8022086cbdea94e8e6d7b32ec1 (diff)
downloadffmpeg-c3a1cbbf5d99337b5e99260eb95c84e65c7587f6.tar.gz
avcodec/eacmv: Check input size for intra frames
Fixes: Timeout Fixes: 71135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EACMV_fuzzer-6251879028293632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/eacmv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index 43dba20fae..15d3550cb8 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -194,12 +194,15 @@ static int cmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
return ret;
+ buf += EA_PREAMBLE_SIZE;
+ if (!(buf[0]&1) && buf_end - buf < s->width * s->height * (int64_t)(100 - s->avctx->discard_damaged_percentage) / 100)
+ return AVERROR_INVALIDDATA;
+
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
memcpy(frame->data[1], s->palette, AVPALETTE_SIZE);
- buf += EA_PREAMBLE_SIZE;
if ((buf[0]&1)) { // subtype
cmv_decode_inter(s, frame, buf+2, buf_end);
frame->flags &= ~AV_FRAME_FLAG_KEY;