diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-09-15 02:08:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-09-15 20:03:25 +0200 |
commit | f2640f76489464f4a0016c729aa04d46d3638abb (patch) | |
tree | 4c2a94580a51a8406129ff916fd7c35c5069cb4d | |
parent | 6645783a3aa46107405c2f7aca65e7a7f13cf5a6 (diff) | |
download | ffmpeg-f2640f76489464f4a0016c729aa04d46d3638abb.tar.gz |
avcodec/shorten: Fix bitstream end check in read_header()
Fixes: Timeout
Fixes: 9961/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5687856176562176
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 28b80c2d52d82eb4f73af5f818dab60946bcf299)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/shorten.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index de2be90e77..6ec1632aac 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -380,7 +380,7 @@ static int read_header(ShortenContext *s) } skip_bytes = get_uint(s, NSKIPSIZE); - if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) { + if ((unsigned)skip_bytes > FFMAX(get_bits_left(&s->gb), 0)/8) { av_log(s->avctx, AV_LOG_ERROR, "invalid skip_bytes: %d\n", skip_bytes); return AVERROR_INVALIDDATA; } |