aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rv34.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-19 22:48:53 +0200
committerMartin Storsjö <martin@martin.st>2011-09-20 10:29:55 +0300
commit4cc7732386eb36661ed22d1200339b38a5fa60bc (patch)
tree0b9563fa75d80f84ee43e7833ff2862c0b842340 /libavcodec/rv34.c
parentc92a2a4eb8b883e82871c2415f757153d263b6b3 (diff)
downloadffmpeg-4cc7732386eb36661ed22d1200339b38a5fa60bc.tar.gz
rv34: Check for invalid slice offsets
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r--libavcodec/rv34.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 8223e92df3..a760e5e147 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1488,8 +1488,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);
@@ -1512,8 +1513,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;
}