[vlc-devel] [PATCH] check for crazy values in rtsp npt range

Rémi Denis-Courmont remi at remlab.net
Sun Mar 25 08:36:14 CEST 2012


On Sun, 25 Mar 2012 08:01:35 +0200, Tobias Güntner <fatbull at web.de> wrote:
> Hello!
> 
>> +                if(d_length > INT64_MAX)
>> +                    *pi64 = INT64_MAX;
>> +                else
>> +                    *pi64 = (int64_t)d_length;
> 
> This will fail if d_length == pow(2, 63).
> 
> When comparing a double and an integer, the integer (no matter what
> size) is first converted to a double. But INT64_MAX (usually 2^63-1) has
> no exact double representation; the nearest
> representable value is INT64_MAX+1 (2^63). Therefore, (pow(2, 63) >
> INT64_MAX) is actually false!
> 
> I'm not sure how to work around this. feclearexcept/llrint/fetestexcept
> perhaps?

Due to -ffast-math, I think math exceptions in VLC code do not work.

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list