8bps: Make the bound-checks consistent
authorLuca Barbato <lu_zero@gentoo.org>
Tue, 23 Jul 2013 12:19:09 +0000 (14:19 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Tue, 23 Jul 2013 21:03:37 +0000 (23:03 +0200)
libavcodec/8bps.c

index dbe1f22..ad1266f 100644 (file)
@@ -105,7 +105,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
                 if ((count = *dp++) <= 127) {
                     count++;
                     dlen -= count + 1;
-                    if (pixptr + count * px_inc > pixptr_end)
+                    if (pixptr_end - pixptr < count * px_inc)
                         break;
                     if (ep - dp < count)
                         return AVERROR_INVALIDDATA;
@@ -115,7 +115,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
                     }
                 } else {
                     count = 257 - count;
-                    if (pixptr + count * px_inc > pixptr_end)
+                    if (pixptr_end - pixptr < count * px_inc)
                         break;
                     while (count--) {
                         *pixptr = *dp;