Commit 2f652853 authored by Alex Converse's avatar Alex Converse

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
parent 1697c29d
...@@ -642,8 +642,12 @@ static int rv10_decode_frame(AVCodecContext *avctx, ...@@ -642,8 +642,12 @@ static int rv10_decode_frame(AVCodecContext *avctx,
if(!avctx->slice_count){ if(!avctx->slice_count){
slice_count = (*buf++) + 1; slice_count = (*buf++) + 1;
buf_size--;
slices_hdr = buf + 4; slices_hdr = buf + 4;
buf += 8 * slice_count; buf += 8 * slice_count;
buf_size -= 8 * slice_count;
if (buf_size <= 0)
return AVERROR_INVALIDDATA;
}else }else
slice_count = avctx->slice_count; slice_count = avctx->slice_count;
...@@ -689,7 +693,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, ...@@ -689,7 +693,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...) 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 = { AVCodec ff_rv10_decoder = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment