[Ffmpeg-devel] Re: [xine-devel] Suspicious code in xine-lib CVS from 2006-04-16 18:43

Måns Rullgård mru
Mon May 29 21:04:51 CEST 2006


Michael Niedermayer <michaelni at gmx.at> writes:

>> - src/libffmpeg/libavcodec/h263.c:1624
>> 
>> Index -1 is invalid.
>
> maybe if you read the c standard very strictly, i dunno, but in
> practice this is correct and intended that way, feel free to send a
> patch if it bothers you

ISO/IEC 9899:1999 section 6.5.2.1 Array subscripting
[...]
A postfix expression followed by an expression in square brackets []
is a subscripted designation of an element of an array object.  The
definition of the subscript operator [] is that E1[E2] is identical to
(*((E1)+(E2))).
[...]

>> - src/libffmpeg/libavcodec/imgconvert.c:1929
>> 
>> size is signed.
>
> no clue what the problem is or which line that is in ffmpeg svn

The nearest use of a variable called 'size' is in avpicture_alloc.
I'm guessing the fuss is about passing an int value to av_malloc,
which takes an unsigned argument.  This is not a problem here.

>> -----------------------------------------------------------------
>> Cases from switch statements that fall through in some cases but 
>> do not have a fall through comment as in most such cases.
>> ------------------------------------------------------------------
>
> sorry but wtf is a fall through comment? on which page of the c standard
> is that mentioned?

They're talking about code like this:

switch(foo){
case 0:
    bar();
case 1:
    baz();
}

Some people (presumably those who have difficulties understanding C
code) insist that a comment mentioning the absence of a break
statement just before a case label.  These are the same kind of people
that put comments like /* add 1 to i */ next to an i++ statement.

>> -----------------------------------------------------------------
>> Lines where boolean expressions are used in non-boolean contexts:
>> 
>> I suspect that at least the lines marked with !!! are bugs
>> -----------------------------------------------------------------

The C language does not have a boolean type, and as such there can be
no boolean contexts.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list