diff options
author | Alex Converse <[email protected]> | 2011-09-09 13:26:49 -0700 |
---|---|---|
committer | Michael Niedermayer <[email protected]> | 2011-09-21 18:01:02 +0200 |
commit | 9f05400ea8575e04f4853e184a38c1f1006dee10 (patch) | |
tree | 75e1da9d9ccabbea29763c5aaf658da75e85fc66 | |
parent | 09cfd6f5974fa1bd13b34443f45e28e690585783 (diff) |
indeo2: fail if input buffer too small
(cherry picked from commit b7ce4f1d1c3add86ece7ca595ea6c4a10b471055)
-rw-r--r-- | libavcodec/indeo2.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index 510f4da01e..152b7cca6c 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -153,6 +153,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 */ @@ -160,7 +167,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); |