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

Alex Converse alex.converse
Wed Aug 25 16:24:08 CEST 2010


On Wed, Aug 25, 2010 at 6:14 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Aug 24, 2010 at 06:10:25PM +0200, alexc wrote:
>> 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.
>
> checking for this via patcheck is likely usefull
>

I agree however the situation gets complicated quickly:

Consider:

int a = get_bits1(gb) ? get_bits(gb, 4) : 0; //ok
int b = get_bits(gb, get_bits(gb, 3)); //ok
int c = get_bits1(gb) || get_bits1(gb); //ok
int d = get_bits_count(gb) + get_bits_count(gb) //ok

int j = get_bits(gb,2) + get_bits(gb,2); //bad
int k = get_bits(gb,2) + show_bits(gb,2); //bad
int l = get_bits(gb,2) +\n
get_bits1(gb,2); //bad
int m = get_bits(gb,2) + function_that_uses(gb); //bad
int n = table[get_bits(gb,2)][get_bits(gb,2)]; //bad

int t = show_bits(gb,2) + function_that_uses(gb); //sometimes bad



More information about the ffmpeg-cvslog mailing list