[FFmpeg-cvslog] avcodec/smc: fix off by 1 error

Michael Niedermayer git at videolan.org
Wed Oct 22 02:25:20 CEST 2014


ffmpeg | branch: release/2.3 | Michael Niedermayer <michaelni at gmx.at> | Fri Oct  3 22:50:45 2014 +0200| [1ac4ae2a32d16c97792f40df660cd8c4a9e049b2] | committer: Michael Niedermayer

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 at gmx.at>
(cherry picked from commit c727401aa9d62335e89d118a5b4e202edf39d905)

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ac4ae2a32d16c97792f40df660cd8c4a9e049b2
---

 libavcodec/smc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 31e6c88..791612e 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -70,7 +70,7 @@ typedef struct SmcContext {
         row_ptr += stride * 4; \
     } \
     total_blocks--; \
-    if (total_blocks < 0) \
+    if (total_blocks < 0 + !!n_blocks) \
     { \
         av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
         return; \



More information about the ffmpeg-cvslog mailing list