[FFmpeg-cvslog] sanm: Use the correct height variable in the decoded_size checks

Michael Niedermayer git at videolan.org
Tue Feb 19 01:35:45 CET 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Tue Feb 12 02:03:28 2013 +0100| [1400f1a1e46d72dc38d4cee66f611d91c3a1f49b] | committer: Michael Niedermayer

sanm: Use the correct height variable in the decoded_size checks

Fixes integer overflow and out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 5260edee7e5bd975837696c8c8c1a80eb2fbd7c1)

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

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

 libavcodec/sanm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index cb94b3c..e317b33 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -416,8 +416,8 @@ 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;
+    if (decoded_size > ctx->height * stride - left - top * stride) {
+        decoded_size = ctx->height * stride - left - top * stride;
         av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
     }
 
@@ -644,8 +644,8 @@ 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;
+    if (decoded_size > ctx->height * stride - left - top * stride) {
+        decoded_size = ctx->height * stride - left - top * stride;
         av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
     }
 



More information about the ffmpeg-cvslog mailing list