diff options
author | Alex Converse <alex.converse@gmail.com> | 2012-03-01 14:07:22 -0800 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2012-03-04 12:26:06 +0100 |
commit | 19da1a39e861968c27504b67d481d32339669e2a (patch) | |
tree | fe08aa0969dc6543c5e7b6269a585443419f98c7 | |
parent | 7e88df99e1d26accc56b0da52d271a57995ecde7 (diff) | |
download | ffmpeg-19da1a39e861968c27504b67d481d32339669e2a.tar.gz |
rv10/20: Fix a buffer overread caused by losing track of the remaining buffer size.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2f6528537fdd88820f3a4683d5e595d7b3a62689)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r-- | libavcodec/rv10.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index ccc09443ec..d7d7ed2fb2 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -642,8 +642,12 @@ static int rv10_decode_frame(AVCodecContext *avctx, if(!avctx->slice_count){ slice_count = (*buf++) + 1; + buf_size--; slices_hdr = buf + 4; buf += 8 * slice_count; + buf_size -= 8 * slice_count; + if (buf_size <= 0) + return AVERROR_INVALIDDATA; }else slice_count = avctx->slice_count; @@ -682,7 +686,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...) } - return buf_size; + return avpkt->size; } AVCodec ff_rv10_decoder = { |