aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-03 22:50:45 +0200
committerAnton Khirnov <anton@khirnov.net>2014-12-20 11:11:46 +0100
commit306ee95088243fefa2dfcb5c355d439db75e2d2a (patch)
treeec4317908a4c76176c1dd1e16166119bc8fb59e7
parent02de44073a8e116ea177b53081219d32ef135ad8 (diff)
downloadffmpeg-306ee95088243fefa2dfcb5c355d439db75e2d2a.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> (cherry picked from commit d423dd72be451462c6fb1cbbe313bed0194001ab) Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit 58dc526ebf722d33bf09275c1241674e0e6b9ef1) Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit f249e9889155599ee3ad0172832d38f68b0c625d) Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/smc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 1834003a39..66e701ec33 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -69,7 +69,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; \