aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-19 22:48:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-20 01:34:53 +0200
commit8716c178ddabe28a01a9fe81fff68d117b779333 (patch)
treed7b862c392eb41cf08036c4693aa5a0b20c79375 /libavcodec
parenta2544524721c1f9e23e568645d7d0b041c270636 (diff)
downloadffmpeg-8716c178ddabe28a01a9fe81fff68d117b779333.tar.gz
Check for invalid slice offsets in real decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/rv34.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 963bd1e3da..22b8e1f7e5 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1492,8 +1492,9 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
slice_count = avctx->slice_count;
//parse first slice header to check whether this frame can be decoded
- if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
- av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
+ if(get_slice_offset(avctx, slices_hdr, 0) < 0 ||
+ get_slice_offset(avctx, slices_hdr, 0) > buf_size){
+ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
return -1;
}
init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8);
@@ -1516,8 +1517,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
else
size = get_slice_offset(avctx, slices_hdr, i+1) - offset;
- if(offset > buf_size){
- av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
+ if(offset < 0 || offset > buf_size || size < 0){
+ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
break;
}