OSDN Git Service

smc: fix the bounds check
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Oct 2014 20:50:45 +0000 (22:50 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 19 Dec 2014 07:01:47 +0000 (08:01 +0100)
Fixes invalid writes when there are more blocks in a run than total
remaining blocks.

CC: libav-stable@libav.org
Bug-ID: CVE-2014-8548
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/smc.c

index 46903ab..c6541da 100644 (file)
@@ -70,7 +70,7 @@ typedef struct SmcContext {
         row_ptr += stride * 4; \
     } \
     total_blocks--; \
-    if (total_blocks < 0) \
+    if (total_blocks < !!n_blocks) \
     { \
         av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
         return; \