Browse Source

avcodec/wcmv: Avoid copying frames if they are unchanged

Improves speed of the testcase by about a factor of 10

Fixes: Timeout
Fixes: 13132/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5664190616829952

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.2
Michael Niedermayer 6 years ago
parent
commit
976dae8b32
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavcodec/wcmv.c

+ 3
- 1
libavcodec/wcmv.c View File

@@ -56,11 +56,13 @@ static int decode_frame(AVCodecContext *avctx,
} }


bytestream2_init(&gb, avpkt->data, avpkt->size); bytestream2_init(&gb, avpkt->data, avpkt->size);
blocks = bytestream2_get_le16(&gb);
if (!blocks)
return avpkt->size;


if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret; return ret;


blocks = bytestream2_get_le16(&gb);
if (blocks > 5) { if (blocks > 5) {
GetByteContext bgb; GetByteContext bgb;
int x = 0, size; int x = 0, size;


Loading…
Cancel
Save