[FFmpeg-devel] [PATCH] avcodec/pngdec: init zlib on decoder init.

Benoit Fouet benoit.fouet at free.fr
Thu Nov 20 09:53:52 CET 2014


Hi,

----- Mail original -----
> Le decadi 30 brumaire, an CCXXIII, Benoit Fouet a écrit :
> > ---
> >  libavcodec/pngdec.c | 30 ++++++++++++------------------
> >  1 file changed, 12 insertions(+), 18 deletions(-)
> > 
> > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> > index 57b73c1..e3d61f6 100644
> > --- a/libavcodec/pngdec.c
> > +++ b/libavcodec/pngdec.c
> > @@ -411,11 +411,6 @@ static int decode_zbuf(AVBPrint *bp, const
> > uint8_t *data,
> >      unsigned buf_size;
> >      int ret;
> >  
> > -    zstream.zalloc = ff_png_zalloc;
> > -    zstream.zfree  = ff_png_zfree;
> > -    zstream.opaque = NULL;
> > -    if (inflateInit(&zstream) != Z_OK)
> > -        return AVERROR_EXTERNAL;
> 
> What happens if one frame contains a damaged zTXt and the next one a
> valid
> one? With the current code, since the zstream is inited each time,
> the first
> one gives whatever it gives and the second one works normally. With
> the
> modified code, I am afraid that the unpredictable state at the end of
> the
> damaged frame will be kept for the good one.
> 

I expect the new patch should address your issue.

Cheers,
-- 
Ben


More information about the ffmpeg-devel mailing list