[FFmpeg-devel] [PATCH] lavf/ffmdec: return proper error code in ffm2_read_header()

Stefano Sabatini stefasab at gmail.com
Mon Sep 1 19:26:28 CEST 2014


On date Monday 2014-09-01 18:23:13 +0200, Michael Niedermayer encoded:
> On Mon, Sep 01, 2014 at 05:00:03PM +0200, Stefano Sabatini wrote:
> > On date Monday 2014-09-01 14:34:23 +0200, Michael Niedermayer encoded:
> > > On Mon, Sep 01, 2014 at 02:05:56PM +0200, Stefano Sabatini wrote:
> > > > ---
> > > >  libavformat/ffmdec.c | 13 +++++++++----
> > > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> > > > index f8fee2f..d74b6cf 100644
> > > > --- a/libavformat/ffmdec.c
> > > > +++ b/libavformat/ffmdec.c
> > > > @@ -238,8 +238,12 @@ static int ffm2_read_header(AVFormatContext *s)
> > > >      AVCodecContext *codec;
> > > >  
> > > >      ffm->packet_size = avio_rb32(pb);
> > > > -    if (ffm->packet_size != FFM_PACKET_SIZE)
> > > > +    if (ffm->packet_size != FFM_PACKET_SIZE) {
> > > > +        av_log(s, AV_LOG_ERROR, "Invalid packet size %d, expected was %d\n",
> > > > +               ffm->packet_size, FFM_PACKET_SIZE);
> > > > +        ret = AVERROR(EINVAL);
> > > 
> > > theres no ret variable in the function
> > > is some hunk missing ?
> > 
> > Up.
> > -- 
> > FFmpeg = Fierce & Fast Moronic Proud Extreme Gangster
> 
> >  ffmdec.c |   14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > ddbe0e225c1ee08ca8a1f7882042c3aa887ae9b4  0002-lavf-ffmdec-return-proper-error-code-in-ffm2_read_he.patch
> > From 63f503fd2b4b9a790e6a7c358c07d90d1bcb927e Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Mon, 1 Sep 2014 14:04:54 +0200
> > Subject: [PATCH] lavf/ffmdec: return proper error code in ffm2_read_header()
> > 
> > ---
> >  libavformat/ffmdec.c | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> > index f8fee2f..abdd3b2 100644
> > --- a/libavformat/ffmdec.c
> > +++ b/libavformat/ffmdec.c
> > @@ -236,10 +236,16 @@ static int ffm2_read_header(AVFormatContext *s)
> >      AVStream *st;
> >      AVIOContext *pb = s->pb;
> >      AVCodecContext *codec;
> > +    int ret;
> >  
> >      ffm->packet_size = avio_rb32(pb);
> > -    if (ffm->packet_size != FFM_PACKET_SIZE)
> > +    if (ffm->packet_size != FFM_PACKET_SIZE) {
> > +        av_log(s, AV_LOG_ERROR, "Invalid packet size %d, expected was %d\n",
> > +               ffm->packet_size, FFM_PACKET_SIZE);
> > +        ret = AVERROR(EINVAL);
> 
> shouldt that be AVERROR_INVALIDDATA ?
> 
> but either way patch LGTM

Fixed and applied, thanks.
-- 
FFmpeg = Fundamentalist Fierce Magical Perfectionist Excellent Gnome


More information about the ffmpeg-devel mailing list