comparison msmpeg4.c @ 12411:7c9d711a4201 libavcodec

msmpeg4v1: fix undefined behaviour in msmpeg4_decode_picture_header() Because the order of evaluation of subexpressions is undefined, two get_bits() calls may not be part of the same expression. In this specific case, using get_bits_long() is simpler. This fixes msmpeg4v1 decoding with armcc.
author mru
date Tue, 24 Aug 2010 15:40:57 +0000
parents c35d7bc64882
children
comparison
equal deleted inserted replaced
12410:7cf900245fce 12411:7c9d711a4201
1393 return -1; 1393 return -1;
1394 } 1394 }
1395 #endif 1395 #endif
1396 1396
1397 if(s->msmpeg4_version==1){ 1397 if(s->msmpeg4_version==1){
1398 int start_code; 1398 int start_code = get_bits_long(&s->gb, 32);
1399 start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16);
1400 if(start_code!=0x00000100){ 1399 if(start_code!=0x00000100){
1401 av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n"); 1400 av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n");
1402 return -1; 1401 return -1;
1403 } 1402 }
1404 1403