comparison src/http/ngx_http_core_module.c @ 6238:8c6e71722aff

Added protection against r->main->count overflow by subrequests. This overflow has become possible after the change in 06e850859a26, since concurrent subrequests are not limited now and each of them is counted in r->main->count.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 31 Aug 2015 23:25:16 +0300
parents 06e850859a26
children 055d1f63960a
comparison
equal deleted inserted replaced
6237:06e850859a26 6238:8c6e71722aff
2431 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 2431 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2432 "subrequests cycle while processing \"%V\"", uri); 2432 "subrequests cycle while processing \"%V\"", uri);
2433 return NGX_ERROR; 2433 return NGX_ERROR;
2434 } 2434 }
2435 2435
2436 /*
2437 * 1000 is reserved for other purposes.
2438 */
2439 if (r->main->count >= 65535 - 1000) {
2440 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
2441 "request reference counter overflow "
2442 "while processing \"%V\"", uri);
2443 return NGX_ERROR;
2444 }
2445
2436 sr = ngx_pcalloc(r->pool, sizeof(ngx_http_request_t)); 2446 sr = ngx_pcalloc(r->pool, sizeof(ngx_http_request_t));
2437 if (sr == NULL) { 2447 if (sr == NULL) {
2438 return NGX_ERROR; 2448 return NGX_ERROR;
2439 } 2449 }
2440 2450