[FFmpeg-devel] [PATCH] check for invalid roq decoding (issue 2521)

Daniel Kang daniel.d.kang
Mon Jan 10 02:19:13 CET 2011


On Sun, Jan 9, 2011 at 8:13 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

>  On Sun, Jan 09, 2011 at 08:06:11PM -0500, Daniel Kang wrote:
> > On Sun, Jan 9, 2011 at 7:58 PM, Michael Niedermayer <michaelni at gmx.at
> >wrote:
> >
> > >  On Sun, Jan 09, 2011 at 05:59:34PM -0500, Daniel Kang wrote:
> > > > ffmpeg does not check for invalid decoding (motion vector I believe)
> > > > when decoding roq files. The patch attached adds a check for this. As
> > > > with the fix for issue 2513 (r26279), ffmpeg will continue to decode
> > > > when it encounters this error.
> > >
> > > >  roqvideo.c |    4 ++++
> > > >  1 file changed, 4 insertions(+)
> > > > 9500ce3dabb508b67dad1f6a34b83fa4be1f8d0b
>  roq_invalid_decode_check.diff
> > > > From 94559de1e80e66baf7cd8a803313b114d481825a Mon Sep 17 00:00:00
> 2001
> > > > From: Daniel Kang <daniel.d.kang at gmail.com>
> > > > Date: Sun, 9 Jan 2011 17:44:09 -0500
> > > > Subject: [PATCH] Add check for invalid decode type
> > > >
> > > > ---
> > > >  libavcodec/roqvideo.c |    4 ++++
> > > >  1 files changed, 4 insertions(+), 0 deletions(-)
> > > >
> > > > diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c
> > > > index 830eb7b..bddd542 100644
> > > > --- a/libavcodec/roqvideo.c
> > > > +++ b/libavcodec/roqvideo.c
> > > > @@ -118,6 +118,10 @@ static inline void
> apply_motion_generic(RoqContext
> > > *ri, int x, int y, int deltax
> > > >      for(cp = 0; cp < 3; cp++) {
> > > >          int outstride = ri->current_frame->linesize[cp];
> > > >          int instride  = ri->last_frame   ->linesize[cp];
> > > > +        if (ri->last_frame->data[cp] == NULL) {
> > > > +            av_log(NULL, AV_LOG_ERROR, "Invalid decode type. Invalid
> > > header?\n");
> > > > +            return;
> > > > +        }
> > >
> > > if one of them is 0 the others are 0 too
> >
> >
> > If that is the case, should I move the check outside the loop (e.g.
> > check for ri->last_frame->data[0])?
>
> thats probably the easiest option here.
> the alternative would be to allocate a last frame ...


I have updated the patch with the check moved outside the loop.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: roq_invalid_decode_check.diff
Type: application/octet-stream
Size: 904 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110109/80268c43/attachment.obj>



More information about the ffmpeg-devel mailing list