On Sun, Sep 18, 2011 at 07:23:02AM +0200, Kostya Shishkov wrote:
> On Sun, Sep 18, 2011 at 12:17:44AM +0200, [email protected] wrote:
> > From: Laurent Aimar <[email protected]>
> > 
> > This prevents crashes with some corrupted bitstreams.
> > ---
> >  libavcodec/rv10.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
> > index d789eff..b659079 100644
> > --- a/libavcodec/rv10.c
> > +++ b/libavcodec/rv10.c
> > @@ -531,8 +531,12 @@ static int rv10_decode_packet(AVCodecContext *avctx,
> >          if(MPV_frame_start(s, avctx) < 0)
> >              return -1;
> >          ff_er_frame_start(s);
> > +    } else {
> > +        if (s->current_picture_ptr->f.pict_type != s->pict_type)
> > +            return -1;
> >      }
> >  
> > +
> >      av_dlog(avctx, "qscale=%d\n", s->qscale);
> >  
> >      /* default quantization values */
> > -- 
> 
> Look good except for unneeded new line and maybe an error message would be
> good.

Updated patch attached.

-- 
fenrir
>From 71bedd0f98001ad57dd097c400beba8bc92de613 Mon Sep 17 00:00:00 2001
From: Laurent Aimar <[email protected]>
Date: Sun, 18 Sep 2011 00:03:08 +0200
Subject: [PATCH] Reject slices that does not have the same type than the first one in RV10/RV20 decoder.

This prevents crashes with some corrupted bitstreams.
---
 libavcodec/rv10.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index d789eff..3ba8102 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -531,6 +531,11 @@ static int rv10_decode_packet(AVCodecContext *avctx,
         if(MPV_frame_start(s, avctx) < 0)
             return -1;
         ff_er_frame_start(s);
+    } else {
+        if (s->current_picture_ptr->f.pict_type != s->pict_type) {
+            av_log(s->avctx, AV_LOG_ERROR, "Slice type mismatch\n");
+            return -1;
+        }
     }
 
     av_dlog(avctx, "qscale=%d\n", s->qscale);
-- 
1.7.2.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to