aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-02 22:04:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-02 22:04:00 +0100
commit422e3a74b9d783571bec775af64f75e4915c40cc (patch)
treedd16ddca72e0fe887c5a851bbb44d9dbc2c288da
parente7b43e8e84e48fccf64cdc62430cb8b5c69e804c (diff)
downloadffmpeg-422e3a74b9d783571bec775af64f75e4915c40cc.tar.gz
rawdec: fix input overread.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/rawdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 68b461d2f1..d912ca285d 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -161,13 +161,13 @@ static int raw_decode(AVCodecContext *avctx,
uint8_t *dst = context->buffer;
buf_size = context->length - 256*4;
if (avctx->bits_per_coded_sample == 4){
- for(i=0; 2*i+1 < buf_size; i++){
+ for(i=0; 2*i+1 < buf_size && i<avpkt->size; i++){
dst[2*i+0]= buf[i]>>4;
dst[2*i+1]= buf[i]&15;
}
linesize_align = 8;
} else {
- for(i=0; 4*i+3 < buf_size; i++){
+ for(i=0; 4*i+3 < buf_size && i<avpkt->size; i++){
dst[4*i+0]= buf[i]>>6;
dst[4*i+1]= buf[i]>>4&3;
dst[4*i+2]= buf[i]>>2&3;