aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-31 22:18:23 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-05 23:16:54 +0200
commit653de8249dab1a6c96bc4d5a049b3b9234c9a4ba (patch)
tree7ebe4fff8bbe5460cbb90135ab74fe78185b4134
parent041ad6d2bb44eb4a673e5de61c7e7b0766170714 (diff)
downloadffmpeg-653de8249dab1a6c96bc4d5a049b3b9234c9a4ba.tar.gz
avcodec/cinepak: Check input packet size before frame reallocation
Reduces time spend decoding 1917/clusterfuzz-testcase-minimized-5023221273329664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit e47057e932ff9a071d52fa1d5d4a956340eb2475) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cinepak.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index 58c26dc69c..7a7466204a 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -322,9 +322,6 @@ static int cinepak_decode (CinepakContext *s)
int y0 = 0;
int encoded_buf_size;
- if (s->size < 10)
- return AVERROR_INVALIDDATA;
-
frame_flags = s->data[0];
num_strips = AV_RB16 (&s->data[8]);
encoded_buf_size = AV_RB24(&s->data[1]);
@@ -439,6 +436,9 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
s->data = buf;
s->size = buf_size;
+ if (s->size < 10)
+ return AVERROR_INVALIDDATA;
+
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;