Fixes: Timeout Fixes: 71135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EACMV_fuzzer-6251879028293632
Unified · Split
| @@ -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)) { // subtype | 206 | 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; |