avcodec/pictordec: Check plane value before doing value/mask computations
[ffmpeg.git] / 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;
                 }
             }
         }