Commit c727401a authored by Michael Niedermayer's avatar 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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 883bc7d2
...@@ -70,7 +70,7 @@ typedef struct SmcContext { ...@@ -70,7 +70,7 @@ typedef struct SmcContext {
row_ptr += stride * 4; \ row_ptr += stride * 4; \
} \ } \
total_blocks--; \ 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"); \ av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
return; \ return; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment