Skip to content

Commit

Permalink
Using strtod() instead of atofp() to support a lot of digits after do…
Browse files Browse the repository at this point in the history
…t in

"start" parameter value.
  • Loading branch information
igorsysoev committed Sep 30, 2011
1 parent a40e7ee commit f3ae6a6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/http/modules/ngx_http_mp4_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,16 @@ ngx_http_mp4_handler(ngx_http_request_t *r)

if (ngx_http_arg(r, (u_char *) "start", 5, &value) == NGX_OK) {

start = ngx_atofp(value.data, value.len, 3);
/*
* A Flash player may send start value with a lot of digits
* after dot so strtod() is used instead of atofp(). NaNs and
* infinities become negative numbers after (int) conversion.
*/

if (start != NGX_ERROR) {
ngx_set_errno(0);
start = (int) (strtod((char *) value.data, NULL) * 1000);

if (ngx_errno == 0 && start >= 0) {
r->allow_ranges = 0;

mp4 = ngx_pcalloc(r->pool, sizeof(ngx_http_mp4_file_t));
Expand Down

0 comments on commit f3ae6a6

Please sign in to comment.