avcodec/pictordec: Check plane value before doing value/mask computations
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 26 Feb 2017 19:28:00 +0000 (20:28 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 28 Feb 2017 00:13:52 +0000 (01:13 +0100)
Fixes integer overflow
Fixes: 675/clusterfuzz-testcase-6722971232108544

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

index a3d72e3..a09ee37 100644 (file)
@@ -77,10 +77,10 @@ static void picmemset(PicContext *s, AVFrame *frame, int value, int run,
                 if (*y < 0) {
                    *y = s->height - 1;
                    *plane += 1;
-                   value <<= bits_per_plane;
-                   mask  <<= bits_per_plane;
                    if (*plane >= s->nb_planes)
                        return;
+                   value <<= bits_per_plane;
+                   mask  <<= bits_per_plane;
                 }
             }
         }