summaryrefslogtreecommitdiff
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2010-08-24 16:10:25 +0000
committerAlex Converse <alex.converse@gmail.com>2010-08-24 16:10:25 +0000
commit4c399dc82b4e74f7b9d09c51ab3314dd68a1fdab (patch)
tree5cde500eacc59aba3b62d8544b2c7c63c6e352b3 /libavcodec/mjpegdec.c
parent37b9706123ff76455d4feb126897b9b5fb7cff69 (diff)
downloadffmpeg-4c399dc82b4e74f7b9d09c51ab3314dd68a1fdab.tar.gz
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. Originally committed as revision 24906 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 4e900a5c73..5f2324516b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1027,7 +1027,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
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 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
/* 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 */