[FFmpeg-cvslog] Check for invalid slice offsets in real decoder.

Laurent Aimar git at videolan.org
Wed Sep 21 21:08:40 CEST 2011


ffmpeg | branch: release/0.8 | Laurent Aimar <fenrir at videolan.org> | Mon Sep 19 22:48:53 2011 +0200| [d2c5904cab95cf064bbe885660eb2af0eaa89714] | committer: Michael Niedermayer

Check for invalid slice offsets in real decoder.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 8716c178ddabe28a01a9fe81fff68d117b779333)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2c5904cab95cf064bbe885660eb2af0eaa89714
---

 libavcodec/rv34.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 9196c95..1810263 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1452,8 +1452,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);
@@ -1476,8 +1477,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;
         }
 



More information about the ffmpeg-cvslog mailing list