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

Unified · Split

libavcodec/eacmv.c+4−1
@@ -194,12 +194,15 @@ static int cmv_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 193 unmodified lines
194 if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)194 if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
195 return ret;195 return ret;
196 196
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
197 if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)201 if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
198 return ret;202 return ret;
199 203
200 memcpy(frame->data[1], s->palette, AVPALETTE_SIZE);204 memcpy(frame->data[1], s->palette, AVPALETTE_SIZE);
201 205
202 buf += EA_PREAMBLE_SIZE;
203 if ((buf[0]&1)) { // subtype206 if ((buf[0]&1)) { // subtype
204 cmv_decode_inter(s, frame, buf+2, buf_end);207 cmv_decode_inter(s, frame, buf+2, buf_end);
205 frame->flags &= ~AV_FRAME_FLAG_KEY;208 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