aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/magicyuv.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-06-19 18:47:53 +0200
committerClément Bœsch <u@pkh.me>2016-06-19 19:01:14 +0200
commitfd1d84bcf6f43b28c4658d6e3f6ded08094e8867 (patch)
treed83f0e50ce41b90926e2b13cb99668112cad659e /libavcodec/magicyuv.c
parente274113292ac2a135cd6aea790631693670fe961 (diff)
downloadffmpeg-fd1d84bcf6f43b28c4658d6e3f6ded08094e8867.tar.gz
lavc/magicyuv: fix undefined behaviour introduced in 8a135a55b
Order of evaluation of parameters in C is not defined.
Diffstat (limited to 'libavcodec/magicyuv.c')
-rw-r--r--libavcodec/magicyuv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index ce0ea9b84a..3bb4c5a8b4 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);