[patch][bugfix]Http mp4: replace strtod() with improved ngx_atofp() because precision problem.

Maxim Dounin mdounin at mdounin.ru
Wed Oct 26 12:31:24 UTC 2016


Hello!

On Wed, Oct 26, 2016 at 05:10:25PM +0800, 胡聪 (hucc) wrote:

> On Wed, Oct 26, 2016 3:34 AM, Maxim Dounin wrote:
> 
> >Using strtod() should be avoided as it has other problems, see 
> >https://trac.nginx.org/nginx/ticket/475.  That is, an additional 
> >variant of ngx_atofp() is a way to go.
> >
> >
> >Last time we've looked into this, we've stumbled upon selecting a 
> >proper name for the additional function.  Looking into this again 
> >I tend to think that proper solution would be to use a special 
> >function withing the ngx_http_mp4_module itself.  Patch below.
> 
> 
> VOD (video on demand) module which support requesting time range
> also need the special function, so i would like to see that nginx-devel
> add a function in Core, that would be helpful. Possible patch below.

If you mean https://github.com/kaltura/nginx-vod-module, then I 
don't think it does.  Quick look suggests that it uses 
milliseconds to specify times instead, and uses ngx_atoi() to 
parse them.  It doesn't use strtod() at all, and the only place it 
uses ngx_atofp() now is to parse rate, and I don't think there are 
reasons to allow arbitrary numbers like in the mp4 case.

The main problem with mp4 was that there were existing Flash 
clients nginx has to be compatible with, and some of them used to 
send incorrect start time specifications.  It is highly unlikely 
that the same unique situation affects other modules.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list