aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/smc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-03 22:50:45 +0200
committerAnton Khirnov <anton@khirnov.net>2014-12-19 08:01:47 +0100
commitd423dd72be451462c6fb1cbbe313bed0194001ab (patch)
tree40997ea03bfc5587db860c5833fe6dc0197e59ae /libavcodec/smc.c
parent0b39ac6f54505a538c21fe49a626de94c518c903 (diff)
downloadffmpeg-d423dd72be451462c6fb1cbbe313bed0194001ab.tar.gz
smc: fix the bounds check
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>
Diffstat (limited to 'libavcodec/smc.c')
-rw-r--r--libavcodec/smc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 46903ab2af..c6541da843 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 < !!n_blocks) \
{ \
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
return; \