[FFmpeg-cvslog] sanm: Check decoded_size.

Michael Niedermayer git at videolan.org
Thu Feb 7 01:22:21 CET 2013


ffmpeg | branch: release/1.0 | Michael Niedermayer <michaelni at gmx.at> | Thu Jan 24 00:27:10 2013 +0100| [89e16e675d3cbe76cf4581f98bf4ac300cab0286] | committer: Michael Niedermayer

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 at gmx.at>
(cherry picked from commit 7357ca900efcf829de4cce4cec6ddc286526d417)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89e16e675d3cbe76cf4581f98bf4ac300cab0286
---

 libavcodec/sanm.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index e2d8c0d..21073e2 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -638,6 +638,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) {



More information about the ffmpeg-cvslog mailing list