Mercurial > libavcodec.hg
diff mjpegdec.c @ 12412:b31e6ace12f6 libavcodec
Fix undefined expressions that use multiple calls to get_bits().
Because the order of evaluation of subexpressions is undefined, two
get_bits() calls may not be part of the same expression.
See also r24902.
author | alexc |
---|---|
date | Tue, 24 Aug 2010 16:10:25 +0000 |
parents | 914f484bb476 |
children | ffb3668ff7af |
line wrap: on
line diff
--- a/mjpegdec.c Tue Aug 24 15:40:57 2010 +0000 +++ b/mjpegdec.c Tue Aug 24 16:10:25 2010 +0000 @@ -1027,7 +1027,7 @@ if(8*len + get_bits_count(&s->gb) > s->gb.size_in_bits) return -1; - id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16); + id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 6; @@ -1134,7 +1134,7 @@ /* Apple MJPEG-A */ if ((s->start_code == APP1) && (len > (0x28 - 8))) { - id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16); + id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 4; if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */