[FFmpeg-devel] [PATCH] avcodec/shorten: Sanity check maxnlpc

Michael Niedermayer michael at niedermayer.cc
Fri Jun 9 04:14:12 EEST 2017


Fixes OOM
Fixes: 2131/clusterfuzz-testcase-minimized-4718045157130240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/shorten.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index b785284aa2..18b77300a0 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -445,6 +445,10 @@ static int read_header(ShortenContext *s)
         s->blocksize = blocksize;
 
         maxnlpc  = get_uint(s, LPCQSIZE);
+        if (maxnlpc > 1024U) {
+            av_log(s->avctx, AV_LOG_ERROR, "maxnlpc is: %d\n", maxnlpc);
+            return AVERROR_INVALIDDATA;
+        }
         s->nmean = get_uint(s, 0);
 
         skip_bytes = get_uint(s, NSKIPSIZE);
-- 
2.13.0



More information about the ffmpeg-devel mailing list