aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-24 00:27:10 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-05 16:47:41 +0100
commit62c9beda0c189db5cb61fa772057e3af9521f293 (patch)
tree5e2a8e97eb91843c89c390f91162571dd21cb1bf /libavcodec
parent0e68b6ddce2945dd367b3d8566dde061b51332af (diff)
downloadffmpeg-62c9beda0c189db5cb61fa772057e3af9521f293.tar.gz
sanm: Check decoded_size.
This prevents a buffer overflow in rle_decode() Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 7357ca900efcf829de4cce4cec6ddc286526d417) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/sanm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index ff70f206e6..0f68e1d1ed 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -639,6 +639,11 @@ static int old_codec47(SANMVideoContext *ctx, int top,
decoded_size = bytestream2_get_le32(&ctx->gb);
bytestream2_skip(&ctx->gb, 8);
+ if (decoded_size > height * stride - left - top * stride) {
+ decoded_size = height * stride - left - top * stride;
+ av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
+ }
+
if (skip & 1)
bytestream2_skip(&ctx->gb, 0x8080);
if (!seq) {