From 6fd221e5f8b0dcd33c249e553ea0be87778f2479 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 23 Jul 2013 14:19:09 +0200 Subject: 8bps: Make the bound-checks consistent --- libavcodec/8bps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavcodec/8bps.c') diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index dbe1f22915..ad1266f6b5 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -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; -- cgit v1.2.1