[FFmpeg-cvslog] sanm: add forgotten check for decoded_size in old_codec37()
Michael Niedermayer
git at videolan.org
Tue Feb 12 01:22:32 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Feb 12 01:09:03 2013 +0100| [365270aec5c2b9284230abc702b11168818f14cf] | committer: Michael Niedermayer
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 at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=365270aec5c2b9284230abc702b11168818f14cf
---
libavcodec/sanm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 101a843..ec01351 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -417,6 +417,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))
More information about the ffmpeg-cvslog
mailing list