diff mbox

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

Message ID 20170609011412.14323-1-michael@niedermayer.cc
State Accepted
Commit e77ddd31a8e14bcf5eccd6008d866ae90b4b0d4c
Headers show

Commit Message

Michael Niedermayer June 9, 2017, 1:14 a.m. UTC
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@niedermayer.cc>
---
 libavcodec/shorten.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer June 16, 2017, 4:56 p.m. UTC | #1
On Fri, Jun 09, 2017 at 03:14:12AM +0200, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavcodec/shorten.c | 4 ++++
>  1 file changed, 4 insertions(+)

applied

[...]
diff mbox

Patch

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);