summaryrefslogtreecommitdiff
path: root/libavcodec/cinepak.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-04-27 23:37:26 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-04-30 21:24:04 +0200
commitb606493717db6424d693e1a944f51171e9e72905 (patch)
tree0ecfeb2219458c62d3709fbf192bdd1cab8cd231 /libavcodec/cinepak.c
parent5a39b797ac46bbf992e76ea363f2c5fab7ebc29f (diff)
downloadffmpeg-b606493717db6424d693e1a944f51171e9e72905.tar.gz
avcodec/cinepak: Check slice_size before allocating image
Fixes: Timeout (16sec -> 125msec) Fixes: 14283/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5742851457024000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/cinepak.c')
-rw-r--r--libavcodec/cinepak.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index 9b0077402f..d26c505222 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -353,6 +353,13 @@ static int cinepak_predecode_check (CinepakContext *s)
if (s->size < 10 + s->sega_film_skip_bytes + num_strips * 12)
return AVERROR_INVALIDDATA;
+ if (num_strips) {
+ uint8_t *data = s->data + 10 + s->sega_film_skip_bytes;
+ int strip_size = AV_RB24 (data + 1);
+ if (strip_size < 12 || strip_size > encoded_buf_size)
+ return AVERROR_INVALIDDATA;
+ }
+
return 0;
}