diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-12 01:09:03 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-19 01:28:30 +0100 |
commit | 1ea5bbc5940d2ea5ec1eea83cccef331d737f5f6 (patch) | |
tree | 51a0859b9105dec06cb5caef242f8f59cd95b5d0 /libavcodec | |
parent | f5955d9f6f9ffdb81864c3de1c7b801782a55725 (diff) | |
download | ffmpeg-1ea5bbc5940d2ea5ec1eea83cccef331d737f5f6.tar.gz |
sanm: add forgotten check for decoded_size in old_codec37()
Fixes out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 365270aec5c2b9284230abc702b11168818f14cf)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/sanm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 0f68e1d1ed..cb94b3cca6 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -416,6 +416,11 @@ static int old_codec37(SANMVideoContext *ctx, int top, flags = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 3); + 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"); + } + ctx->rotate_code = 0; if (((seq & 1) || !(flags & 1)) && (compr && compr != 2)) |