comparison qdm2.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 c69dd071f7d4
children
comparison
equal deleted inserted replaced
12411:7c9d711a4201 12412:b31e6ace12f6
1207 packet_bytes = (q->compressed_size - get_bits_count(&gb) / 8); 1207 packet_bytes = (q->compressed_size - get_bits_count(&gb) / 8);
1208 1208
1209 init_get_bits(&gb, header.data, header.size*8); 1209 init_get_bits(&gb, header.data, header.size*8);
1210 1210
1211 if (header.type == 2 || header.type == 4 || header.type == 5) { 1211 if (header.type == 2 || header.type == 4 || header.type == 5) {
1212 int csum = 257 * get_bits(&gb, 8) + 2 * get_bits(&gb, 8); 1212 int csum = 257 * get_bits(&gb, 8);
1213 csum += 2 * get_bits(&gb, 8);
1213 1214
1214 csum = qdm2_packet_checksum(q->compressed_data, q->checksum_size, csum); 1215 csum = qdm2_packet_checksum(q->compressed_data, q->checksum_size, csum);
1215 1216
1216 if (csum != 0) { 1217 if (csum != 0) {
1217 q->has_errors = 1; 1218 q->has_errors = 1;