diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-05-12 22:06:30 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-05-14 12:06:26 +0200 |
commit | 87a54e150e9cb6479e590faaf66d9f405a97fb6c (patch) | |
tree | e2de127a614e2cea75ef282c0230713b63d9faa0 | |
parent | 8b2140de6314f9ea9ebbaf6a127cca35306d8a67 (diff) | |
download | ffmpeg-streaming-87a54e150e9cb6479e590faaf66d9f405a97fb6c.zip ffmpeg-streaming-87a54e150e9cb6479e590faaf66d9f405a97fb6c.tar.gz |
avcodec/cinepak: Check available input against encoded buffer size
Fixes: Timeout (12sec -> 2sec)
Fixes: 14606/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5738687561728000
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>
-rw-r--r-- | libavcodec/cinepak.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index a5132dd..aeb15de 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -323,6 +323,9 @@ static int cinepak_predecode_check (CinepakContext *s) num_strips = AV_RB16 (&s->data[8]); encoded_buf_size = AV_RB24(&s->data[1]); + if (s->size < encoded_buf_size * (int64_t)(100 - s->avctx->discard_damaged_percentage) / 100) + return AVERROR_INVALIDDATA; + /* if this is the first frame, check for deviant Sega FILM data */ if (s->sega_film_skip_bytes == -1) { if (!encoded_buf_size) { |