1
From 6550e2b5c51cf7d3d40f666f6966b57f622ffffc Mon Sep 17 00:00:00 2001
2
From: Alex Converse <alex.converse@gmail.com>
3
Date: Fri, 9 Sep 2011 13:26:49 -0700
4
Subject: [PATCH 49/70] indeo2: fail if input buffer too small
6
(cherry picked from commit b7ce4f1d1c3add86ece7ca595ea6c4a10b471055)
8
Signed-off-by: Anton Khirnov <anton@khirnov.net>
10
libavcodec/indeo2.c | 8 +++++++-
11
1 files changed, 7 insertions(+), 1 deletions(-)
13
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
14
index 6cf893b..544f476 100644
15
--- a/libavcodec/indeo2.c
16
+++ b/libavcodec/indeo2.c
17
@@ -156,6 +156,13 @@ static int ir2_decode_frame(AVCodecContext *avctx,
21
+ start = 48; /* hardcoded for now */
23
+ if (start >= buf_size) {
24
+ av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size);
25
+ return AVERROR_INVALIDDATA;
28
s->decode_delta = buf[18];
30
/* decide whether frame uses deltas or not */
31
@@ -163,7 +170,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
32
for (i = 0; i < buf_size; i++)
33
buf[i] = av_reverse[buf[i]];
35
- start = 48; /* hardcoded for now */
37
init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);