diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-12 20:42:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-12 20:50:13 +0100 |
commit | 0e239b22dbbe6808ac08ca72825f734076d4dc81 (patch) | |
tree | ac33f520dc2bda5c47a92cd2db2a5a448200864d /libavcodec/xan.c | |
parent | a9456c7c5ca883b5a3947e59a9fba5587e18e119 (diff) | |
download | ffmpeg-streaming-0e239b22dbbe6808ac08ca72825f734076d4dc81.zip ffmpeg-streaming-0e239b22dbbe6808ac08ca72825f734076d4dc81.tar.gz |
xan: check size_segment before reading, fixes out of array read.
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 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 25e62e6..bccbe24 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -359,17 +359,29 @@ static int xan_wc3_decode_frame(XanContext *s) { case 9: case 19: + if (buf_end - size_segment < 1) { + av_log(s->avctx, AV_LOG_ERROR, "size_segment overread\n"); + return AVERROR_INVALIDDATA; + } size = *size_segment++; break; case 10: case 20: + if (buf_end - size_segment < 2) { + av_log(s->avctx, AV_LOG_ERROR, "size_segment overread\n"); + return AVERROR_INVALIDDATA; + } size = AV_RB16(&size_segment[0]); size_segment += 2; break; case 11: case 21: + if (buf_end - size_segment < 3) { + av_log(s->avctx, AV_LOG_ERROR, "size_segment overread\n"); + return AVERROR_INVALIDDATA; + } size = AV_RB24(size_segment); size_segment += 3; break; |