History

avcodec/eacmv: Check input size for intra frames

Fixes: Timeout Fixes: 71135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EACMV_fuzzer-6251879028293632

Michael Niedermayer committed 2 years ago

Commit c3a1cbb1 parent 9a823fb1 file · +4 −1Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/eacmv.c+4−1
@@ -194,12 +194,15 @@ static int cmv_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 193 unmodified lines
194194 if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
195195 return ret;
196196
197+ buf += EA_PREAMBLE_SIZE;
198+ if (!(buf[0]&1) && buf_end - buf < s->width * s->height * (int64_t)(100 - s->avctx->discard_damaged_percentage) / 100)
199+ return AVERROR_INVALIDDATA;
200+
197201 if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
198202 return ret;
199203
200204 memcpy(frame->data[1], s->palette, AVPALETTE_SIZE);
201205
202− buf += EA_PREAMBLE_SIZE;
203206 if ((buf[0]&1)) { // subtype
204207 cmv_decode_inter(s, frame, buf+2, buf_end);
205208 frame->flags &= ~AV_FRAME_FLAG_KEY;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t