[FFmpeg-cvslog] avcodec/pixlet: Fix runtime error: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int'

Michael Niedermayer git at videolan.org
Fri Jun 2 03:08:34 EEST 2017


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Sat May 27 13:03:36 2017 +0200| [dbff2d602d86c13627ee785a748988d4f1c964cc] | committer: Michael Niedermayer

avcodec/pixlet: Fix runtime error: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int'

Fixes: 1829/clusterfuzz-testcase-minimized-5527165321871360

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 77d98898211eeb0241e8411428b0b364a6231744)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbff2d602d86c13627ee785a748988d4f1c964cc
---

 libavcodec/pixlet.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 0dfd5edbf7..0e541a9ccb 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -594,6 +594,10 @@ static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
     width  = bytestream2_get_be32(&ctx->gb);
     height = bytestream2_get_be32(&ctx->gb);
 
+    if (    width > INT_MAX - (1U << (NB_LEVELS + 1))
+        || height > INT_MAX - (1U << (NB_LEVELS + 1)))
+        return AVERROR_INVALIDDATA;
+
     w = FFALIGN(width,  1 << (NB_LEVELS + 1));
     h = FFALIGN(height, 1 << (NB_LEVELS + 1));
 



More information about the ffmpeg-cvslog mailing list