diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-02-19 19:05:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-02-25 18:03:24 +0100 |
commit | 976dae8b32f48d17cccfd6b19d2beb01770dfa7c (patch) | |
tree | 679dc7668a61c12733c586d400dbcca0cbeaee78 | |
parent | 286a33e42944919774c7386137ae0f546985c260 (diff) | |
download | ffmpeg-976dae8b32f48d17cccfd6b19d2beb01770dfa7c.tar.gz |
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>
-rw-r--r-- | libavcodec/wcmv.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c index f03761b343..2988c15b23 100644 --- a/libavcodec/wcmv.c +++ b/libavcodec/wcmv.c @@ -56,11 +56,13 @@ static int decode_frame(AVCodecContext *avctx, } 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) return ret; - blocks = bytestream2_get_le16(&gb); if (blocks > 5) { GetByteContext bgb; int x = 0, size; |