[FFmpeg-cvslog] avcodec/shorten: Sanity check nmeans
Michael Niedermayer
git at videolan.org
Tue Jul 10 12:05:54 EEST 2018
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Tue Jun 5 13:03:48 2018 +0200| [f41da2bd5ff7d9d6b1141284dbd526d8b232e29b] | committer: Michael Niedermayer
avcodec/shorten: Sanity check nmeans
Fixes: OOM
Fixes: 8195/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5179785826271232
The reference software appears to use longs for 32bits and it uses int for nmeans
hinting that the intended maximum size was not 32bit.
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit d91a0b503d7a886587281bc1ee42476aa5e89f85)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f41da2bd5ff7d9d6b1141284dbd526d8b232e29b
---
libavcodec/shorten.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index e4bf2e0035..b8a5664ce9 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -374,6 +374,10 @@ static int read_header(ShortenContext *s)
return AVERROR_INVALIDDATA;
}
s->nmean = get_uint(s, 0);
+ if (s->nmean > 32768U) {
+ av_log(s->avctx, AV_LOG_ERROR, "nmean is: %d\n", s->nmean);
+ return AVERROR_INVALIDDATA;
+ }
skip_bytes = get_uint(s, NSKIPSIZE);
if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) {
More information about the ffmpeg-cvslog
mailing list