[FFmpeg-cvslog] avcodec/shorten: Sanity check nmeans
Michael Niedermayer
git at videolan.org
Mon Jul 16 21:32:05 EEST 2018
ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Tue Jun 5 13:03:48 2018 +0200| [f51163b1666e0d43fc94ac839e80f044ecb8b7c5] | 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=f51163b1666e0d43fc94ac839e80f044ecb8b7c5
---
libavcodec/shorten.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 7157bb0cae..0c29275df2 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -450,6 +450,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