diff mbox

[FFmpeg-devel,1/2] avcodec/pixlet: fixes integer overflow in read_highpass()

Message ID 20170817015457.6723-1-michael@niedermayer.cc
State Accepted
Commit cadab5a2a74d715fc16325bd89f8b8091def1083
Headers show

Commit Message

Michael Niedermayer Aug. 17, 2017, 1:54 a.m. UTC
Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself
Fixes: 2879/clusterfuzz-testcase-minimized-6317542639403008

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

Comments

Michael Niedermayer Aug. 18, 2017, 9:34 a.m. UTC | #1
On Thu, Aug 17, 2017 at 03:54:56AM +0200, Michael Niedermayer wrote:
> Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself
> Fixes: 2879/clusterfuzz-testcase-minimized-6317542639403008
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pixlet.c | 3 +++
>  1 file changed, 3 insertions(+)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index a9661d3ab6..088226bdda 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -331,6 +331,9 @@  static int read_highpass(AVCodecContext *avctx, uint8_t *ptr, int plane, AVFrame
             return AVERROR_INVALIDDATA;
         }
 
+        if (a == INT32_MIN)
+            return AVERROR_INVALIDDATA;
+
         ret = read_high_coeffs(avctx, ptr + bytestream2_tell(&ctx->gb), dest, size,
                                c, (b >= FFABS(a)) ? b : a, d,
                                ctx->band[plane][i + 1].width, stride);