[FFmpeg-cvslog] sanm: Check dimensions before use

Michael Niedermayer git at videolan.org
Mon May 13 00:52:33 CEST 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Tue May  7 21:58:27 2013 +0200| [dafd8228bc0f7d9a6afd4e84a476b3a73e0a5a4b] | committer: Michael Niedermayer

sanm: Check dimensions before use

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 9dd04f6d8cdd1c10c28b2cb4252c1a41df581915)

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

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

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

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index e317b33..60437c0 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -726,6 +726,11 @@ static int process_frame_obj(SANMVideoContext *ctx)
     w     = bytestream2_get_le16u(&ctx->gb);
     h     = bytestream2_get_le16u(&ctx->gb);
 
+    if (!w || !h) {
+        av_log(ctx->avctx, AV_LOG_ERROR, "dimensions are invalid\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (ctx->width < left + w || ctx->height < top + h) {
         if (av_image_check_size(FFMAX(left + w, ctx->width),
                                 FFMAX(top  + h, ctx->height), 0, ctx->avctx) < 0)



More information about the ffmpeg-cvslog mailing list