[FFmpeg-devel] [PATCH] img2dec: Don't leave AVIOContexts open on zero byte files

Tomas Härdin tomas.hardin at codemill.se
Fri Sep 7 13:29:19 CEST 2012


On Fri, 2012-09-07 at 12:10 +0200, Michael Niedermayer wrote:
> On Fri, Sep 07, 2012 at 11:03:47AM +0200, Tomas Härdin wrote:
> > @@ -379,7 +380,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
> >  
> >      pkt->size= 0;
> >      for(i=0; i<3; i++){
> > -        if(size[i]){
> > +        if(ret[i] >= 0){
> 
> does it work if f[i] is checked here ? (and set to NULL at the top)
> that would be quite a but simpler

You're right, that works (if I change a check further up from ==1 to
>=1). I even thought of that when I wrote this patch, but didn't go that
route for some reason. New patch attached.

make fate passes. Tested with test.jpeg and test.Y, test.U, test.V.

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-img2dec-Don-t-leave-AVIOContexts-open-on-zero-byte-f.patch
Type: text/x-patch
Size: 2314 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120907/0151597a/attachment.bin>


More information about the ffmpeg-devel mailing list