avcodec/mjpegdec: Fix runtime error: left shift of negative value -511
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 1 Mar 2017 15:32:09 +0000 (16:32 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 3 Mar 2017 00:03:29 +0000 (01:03 +0100)
Fixes: 693/clusterfuzz-testcase-6109776066904064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mjpegdec.c

index 69469c5..2b5adfc 100644 (file)
@@ -1157,7 +1157,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
                             if (s->interlaced && s->bottom_field)
                                 ptr16 += linesize >> 1;
                             pred &= mask;
-                            *ptr16= pred + (dc << point_transform);
+                            *ptr16= pred + ((unsigned)dc << point_transform);
                         }
                         if (++x == h) {
                             x = 0;