[FFmpeg-devel] FATE & Regressions (and PPC is broken)

Vitor Sessak vitor1001
Sun Mar 16 10:25:50 CET 2008


Hi

Michael Niedermayer wrote:
> On Sun, Mar 16, 2008 at 12:25:41AM +0100, Vitor Sessak wrote:
>> Hi
>>
>> Mike Melanson wrote:
>>
>> [...]
>>
>>> x86_32/icc:
>>> This is weird; if I build icc and then run 'make test', it crashes here
>>> (tried twice with a 'make clean' in between):
>>> "/home/melanson/ffmpeg/build-icc"/tests/audiogen tests/asynth1.sw
>>> Segmentation fault (core dumped)
>>> make: *** [tests/asynth1.sw] Error 139
>> This can be fixed with the following patch, but I don't know if it is the 
>> right fix.
> 
> Could you shed some light on the question where it crashes and why the
> patch fixes it?
> 

In the code

> 
> static int int_cos(int a)
> {
>     int neg, v, f;
>     const unsigned short *p;
> 
>     a = a & (FRAC_ONE - 1); /* modulo 2 * pi */
>     if (a >= (FRAC_ONE / 2))
>         a = FRAC_ONE - a;
>     neg = 0;
>     if (a > (FRAC_ONE / 4)) {
>         neg = -1;
>         a = (FRAC_ONE / 2) - a;
>     }
> 
>     p = cos_table + (a >> CSHIFT);

When a is negative, (a >> CSHIFT) can be negative (not only in icc but 
in gcc too). So p[0] will dereference an invalid pointer.

>     /* linear interpolation */
>     f = a & ((1 << CSHIFT) - 1);
>     v = p[0] + (((p[1] - p[0]) * f + (1 << (CSHIFT - 1))) >> CSHIFT);
>     v = (v ^ neg) - neg;
>     v = v << (FRAC_BITS - 15);
>     return v;
> }

-Vitor




More information about the ffmpeg-devel mailing list