Opened 11 years ago

Last modified 11 years ago

#256 closed defect

включение limit_rate приводит к переполнению на 32битных системах — at Initial Version

Reported by: Алексей Антропов Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.2.x
Keywords: Cc:
uname -a: Isilon OneFS isilon-1 v6.5.4.10
nginx -V: 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

Description

при вычислении лимита отдачи в src/http/ngx_http_write_filter_module.c
limit = r->limit_rate * (ngx_time() - r->start_sec + 1)..

в 32битных системах вычисление лимита может превысить 232, заметили при limit_rate 1200k через один час отдача останавливается.

Помогает приведение типа.

--- 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) {

Change History (0)

Note: See TracTickets for help on using tickets.