﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
256	включение limit_rate приводит к переполнению на 32битных системах	Алексей Антропов	Valentin V. Bartenev	"При вычислении лимита отдачи в `src/http/ngx_http_write_filter_module.c` 
{{{
#!c
limit = r->limit_rate * (ngx_time() - r->start_sec + 1)
        - (c->sent - clcf->limit_rate_after);
}}}
в 32битных системах вычисление лимита может превысить 2^32^, заметили при limit_rate 1200k через один час отдача останавливается.

Помогает приведение типа:
{{{
#!c
--- nginx-1.2.5.orig/src/http/ngx_http_write_filter_module.c    2012-12-12 10:30:16.936031137 +0200
+++ nginx-1.2.5/src/http/ngx_http_write_filter_module.c    2012-12-12 10:35:44.253313996 +0200
@@ -207,7 +207,7 @@
     }
 
     if (r->limit_rate) {
-        limit = r->limit_rate * (ngx_time() - r->start_sec + 1)
+        limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1)
                 - (c->sent - clcf->limit_rate_after);
 
         if (limit <= 0) {
}}}"	defect	assigned	major		nginx-core	1.2.x				Isilon OneFS isilon-1 v6.5.4.10	"nginx version: nginx/1.2.4
built by gcc 4.2.1 20070719  [FreeBSD]
configure arguments: --with-pcre=pcre-8.31 --with-http_perl_module --add-module=nginx_mod_h264_streaming-2.2.8 --add-module=ngx_http_file_compose_filter_module --with-debug
"
