Browse code

avcodec/smc: fix off by 1 error

Fixes out of array access
Fixes: asan_heap-oob_1685bf0_5_asan_heap-oob_1f35116_430_smc.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c727401aa9d62335e89d118a5b4e202edf39d905)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/10/04 05:50:45
Showing 1 changed files
... ...
@@ -70,7 +70,7 @@ typedef struct SmcContext {
70 70
         row_ptr += stride * 4; \
71 71
     } \
72 72
     total_blocks--; \
73
-    if (total_blocks < 0) \
73
+    if (total_blocks < 0 + !!n_blocks) \
74 74
     { \
75 75
         av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
76 76
         return; \