]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/scpr.c
avcodec/mpc8: check for overread first
[ffmpeg] / libavcodec / scpr.c
index cbe1bc40d9c8162e933c25aa855c6949e70cb7eb..ad6073dbf0118d399b755c3e2d66454b8058947e 100644 (file)
@@ -681,6 +681,8 @@ static int decompress_p(AVCodecContext *avctx,
                                 return AVERROR_INVALIDDATA;
 
                             if (bx == 0) {
+                                if (by < 2)
+                                    return AVERROR_INVALIDDATA;
                                 z = backstep;
                             } else {
                                 z = 0;
@@ -710,6 +712,8 @@ static int decompress_p(AVCodecContext *avctx,
                                 return AVERROR_INVALIDDATA;
 
                             if (bx == 0) {
+                                if (by < 2)
+                                    return AVERROR_INVALIDDATA;
                                 z = backstep;
                             } else {
                                 z = 0;