diff options
author | Alex Converse <alex.converse@gmail.com> | 2011-09-09 13:26:49 -0700 |
---|---|---|
committer | Alex Converse <alex.converse@gmail.com> | 2011-09-09 15:01:00 -0700 |
commit | b7ce4f1d1c3add86ece7ca595ea6c4a10b471055 (patch) | |
tree | 4c54abdd6253b97d81bc7b1a51edbd3ca1fb7db0 /libavcodec/indeo2.c | |
parent | 68ca330cbd479111db9cb7649d7530ad59f04cc8 (diff) | |
download | ffmpeg-b7ce4f1d1c3add86ece7ca595ea6c4a10b471055.tar.gz |
indeo2: fail if input buffer too small
Diffstat (limited to 'libavcodec/indeo2.c')
-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 591c1ceb89..398a9acd92 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); |