[FFmpeg-cvslog] r24906 - in trunk/libavcodec: mjpegdec.c qdm2.c

alexc subversion
Tue Aug 24 18:10:25 CEST 2010


Author: alexc
Date: Tue Aug 24 18:10:25 2010
New Revision: 24906

Log:
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.

Modified:
   trunk/libavcodec/mjpegdec.c
   trunk/libavcodec/qdm2.c

Modified: trunk/libavcodec/mjpegdec.c
==============================================================================
--- trunk/libavcodec/mjpegdec.c	Tue Aug 24 17:48:20 2010	(r24905)
+++ trunk/libavcodec/mjpegdec.c	Tue Aug 24 18:10:25 2010	(r24906)
@@ -1027,7 +1027,7 @@ static int mjpeg_decode_app(MJpegDecodeC
     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(MJpegDecodeC
     /* 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 */

Modified: trunk/libavcodec/qdm2.c
==============================================================================
--- trunk/libavcodec/qdm2.c	Tue Aug 24 17:48:20 2010	(r24905)
+++ trunk/libavcodec/qdm2.c	Tue Aug 24 18:10:25 2010	(r24906)
@@ -1209,7 +1209,8 @@ static void qdm2_decode_super_block (QDM
     init_get_bits(&gb, header.data, header.size*8);
 
     if (header.type == 2 || header.type == 4 || header.type == 5) {
-        int csum = 257 * get_bits(&gb, 8) + 2 * get_bits(&gb, 8);
+        int csum  = 257 * get_bits(&gb, 8);
+            csum +=   2 * get_bits(&gb, 8);
 
         csum = qdm2_packet_checksum(q->compressed_data, q->checksum_size, csum);
 



More information about the ffmpeg-cvslog mailing list