[FFmpeg-devel] [PATCH] jpeg2000: fix for uninitialized data errors in valgrind/memcheck

Michael Niedermayer michaelni at gmx.at
Mon May 6 21:50:38 CEST 2013


On Thu, May 02, 2013 at 11:36:34PM +0200, Michael Niedermayer wrote:
> On Mon, Apr 29, 2013 at 12:25:09PM +0200, Nicolas Bertrand wrote:
> > ---
> >  libavcodec/jpeg2000dec.c |   18 ++++++++++++++----
> >  1 file changed, 14 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index c1bd772..7b902fa 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -632,7 +632,14 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
> >              Jpeg2000Cblk *cblk = prec->cblk + cblkno;
> >              if (s->buf_end - s->buf < cblk->lengthinc)
> >                  return AVERROR(EINVAL);
> > -            bytestream_get_buffer(&s->buf, cblk->data, cblk->lengthinc);
> > +            /* A code-block data can be empty. In that case initialize data
> > +             * with 0xffff. */
> > +            if (cblk->lengthinc > 0)
> > +                bytestream_get_buffer(&s->buf, cblk->data, cblk->lengthinc);
> > +            else {
> > +                cblk->data[0] = 0xff;
> > +                cblk->data[1] = 0xff;
> > +            }
> 
> is this also working for lengthinc == 1 ?

applied and patch that fixes the lengthinc == 1 case posted

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130506/493757b0/attachment.asc>


More information about the ffmpeg-devel mailing list