aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-17 16:56:30 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-21 19:50:03 +0200
commit30d7dce94fc74a8ef8369ffe97f0b8b5484ff502 (patch)
tree7777d9cb3bc0389811c97fac02fa96b89b33193a /libavcodec
parent6e21f03547a6fd4cb5d9e2414270b451613a3b50 (diff)
downloadffmpeg-30d7dce94fc74a8ef8369ffe97f0b8b5484ff502.tar.gz
Fix potential overreads in rv34 decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 9a0a64cb26bc6aaa7f29106bded8a27f3db918ee)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/rv34.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index f0f472dcaf..ba88916f5d 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1443,6 +1443,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
slice_count = (*buf++) + 1;
slices_hdr = buf + 4;
buf += 8 * slice_count;
+ buf_size -= 1 + 8 * slice_count;
}else
slice_count = avctx->slice_count;
@@ -1461,7 +1462,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
|| avctx->skip_frame >= AVDISCARD_ALL)
- return buf_size;
+ return avpkt->size;
for(i=0; i<slice_count; i++){
int offset= get_slice_offset(avctx, slices_hdr, i);
@@ -1510,7 +1511,7 @@ int ff_rv34_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;
}
av_cold int ff_rv34_decode_end(AVCodecContext *avctx)