[FFmpeg-devel] [PATCH] lavc/magicyuv: fix undefined behaviour introduced in 8a135a55b

Clement Boesch u at pkh.me
Sun Jun 19 19:01:57 CEST 2016


On Sun, Jun 19, 2016 at 07:00:50PM +0200, Paul B Mahol wrote:
> On 6/19/16, Clement Boesch <u at pkh.me> wrote:
> > Order of evaluation of parameters in C is not defined.
> > ---
> >  libavcodec/magicyuv.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
> > index ce0ea9b..3bb4c5a 100644
> > --- a/libavcodec/magicyuv.c
> > +++ b/libavcodec/magicyuv.c
> > @@ -245,7 +245,7 @@ static int decode_frame(AVCodecContext *avctx,
> >      AVFrame *p = data;
> >      GetByteContext gb;
> >      GetBitContext b;
> > -    int i, j, k;
> > +    int i, j, k, width, height;
> >
> >      bytestream2_init(&gb, avpkt->data, avpkt->size);
> >      if (bytestream2_get_le32(&gb) != MKTAG('M','A','G','Y'))
> > @@ -309,7 +309,9 @@ static int decode_frame(AVCodecContext *avctx,
> >      s->interlaced = !!(bytestream2_get_byte(&gb) & 2);
> >      bytestream2_skip(&gb, 3);
> >
> > -    if ((ret = ff_set_dimensions(avctx, bytestream2_get_le32(&gb),
> > bytestream2_get_le32(&gb))) < 0)
> > +    width  = bytestream2_get_le32(&gb);
> > +    height = bytestream2_get_le32(&gb);
> > +    if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
> >          return ret;
> >
> >      slice_width = bytestream2_get_le32(&gb);
> > --
> > 2.8.3
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> ok

applied, thanks

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160619/95b301d3/attachment.sig>


More information about the ffmpeg-devel mailing list