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

Clément Bœsch git at videolan.org
Sun Jun 19 19:01:20 CEST 2016


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Jun 19 18:47:53 2016 +0200| [fd1d84bcf6f43b28c4658d6e3f6ded08094e8867] | committer: Clément Bœsch

lavc/magicyuv: fix undefined behaviour introduced in 8a135a55b

Order of evaluation of parameters in C is not defined.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd1d84bcf6f43b28c4658d6e3f6ded08094e8867
---

 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);



More information about the ffmpeg-cvslog mailing list