diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-15 15:36:38 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-15 16:06:52 +0200 |
commit | b1096b6ee7d51c8e2b900af375b3f14194241ac2 (patch) | |
tree | 497c8b070a22ae2efa2b19e8bdd230ac9aeebc7d /libavcodec/xan.c | |
parent | b962932cba61f06c8da3e7f70e519dec1c1dd88a (diff) | |
download | ffmpeg-b1096b6ee7d51c8e2b900af375b3f14194241ac2.tar.gz |
xan: check for vector_segment overread
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/xan.c')
-rw-r--r-- | libavcodec/xan.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c index cfaca81e16..155dee9595 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -288,6 +288,7 @@ static int xan_wc3_decode_frame(XanContext *s) { const unsigned char *size_segment; const unsigned char *vector_segment; const unsigned char *imagedata_segment; + const unsigned char *buf_end = s->buf + s->size; int huffman_offset, size_offset, vector_offset, imagedata_offset, imagedata_size; @@ -392,6 +393,10 @@ static int xan_wc3_decode_frame(XanContext *s) { imagedata_size -= size; } } else { + if (vector_segment >= buf_end) { + av_log(s->avctx, AV_LOG_ERROR, "vector_segment overread\n"); + return AVERROR_INVALIDDATA; + } /* run-based motion compensation from last frame */ motion_x = sign_extend(*vector_segment >> 4, 4); motion_y = sign_extend(*vector_segment & 0xF, 4); |