comparison 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
comparison
equal deleted inserted replaced
12411:7c9d711a4201 12412:b31e6ace12f6
1025 if (len < 5) 1025 if (len < 5)
1026 return -1; 1026 return -1;
1027 if(8*len + get_bits_count(&s->gb) > s->gb.size_in_bits) 1027 if(8*len + get_bits_count(&s->gb) > s->gb.size_in_bits)
1028 return -1; 1028 return -1;
1029 1029
1030 id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16); 1030 id = get_bits_long(&s->gb, 32);
1031 id = av_be2ne32(id); 1031 id = av_be2ne32(id);
1032 len -= 6; 1032 len -= 6;
1033 1033
1034 if(s->avctx->debug & FF_DEBUG_STARTCODE){ 1034 if(s->avctx->debug & FF_DEBUG_STARTCODE){
1035 av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id); 1035 av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
1132 } 1132 }
1133 1133
1134 /* Apple MJPEG-A */ 1134 /* Apple MJPEG-A */
1135 if ((s->start_code == APP1) && (len > (0x28 - 8))) 1135 if ((s->start_code == APP1) && (len > (0x28 - 8)))
1136 { 1136 {
1137 id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16); 1137 id = get_bits_long(&s->gb, 32);
1138 id = av_be2ne32(id); 1138 id = av_be2ne32(id);
1139 len -= 4; 1139 len -= 4;
1140 if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */ 1140 if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */
1141 { 1141 {
1142 #if 0 1142 #if 0