[FFmpeg-cvslog] indeo2: fail if input buffer too small

Alex Converse git at videolan.org
Thu Sep 22 01:17:27 CEST 2011


ffmpeg | branch: release/0.8 | Alex Converse <alex.converse at gmail.com> | Fri Sep  9 13:26:49 2011 -0700| [6b1af6a3284e7146b619dff96d88492d47645050] | committer: Anton Khirnov

indeo2: fail if input buffer too small
(cherry picked from commit b7ce4f1d1c3add86ece7ca595ea6c4a10b471055)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavcodec/indeo2.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index 6cf893b..544f476 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -156,6 +156,13 @@ static int ir2_decode_frame(AVCodecContext *avctx,
         return -1;
     }
 
+    start = 48; /* hardcoded for now */
+
+    if (start >= buf_size) {
+        av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size);
+        return AVERROR_INVALIDDATA;
+    }
+
     s->decode_delta = buf[18];
 
     /* decide whether frame uses deltas or not */
@@ -163,7 +170,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
     for (i = 0; i < buf_size; i++)
         buf[i] = av_reverse[buf[i]];
 #endif
-    start = 48; /* hardcoded for now */
 
     init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
 



More information about the ffmpeg-cvslog mailing list