summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-02-05 19:27:18 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-02-05 19:27:18 +0000
commit915bc544030472d2516a50d317afd82bccb022e1 (patch)
tree7c235c61893554352831c22f2dea282e2ef04806
parenta491bd5799bf04ac6ea85d5090ac22f603a981b4 (diff)
downloadnginx-915bc544030472d2516a50d317afd82bccb022e1.tar.gz
Merge of r4405:
Fixed division by zero exception in ngx_hash_init(). The ngx_hash_init() function did not expect call with zero elements count, which caused FPE error on configs with an empty "types" block in http context and "types_hash_max_size" > 10000.
-rw-r--r--src/core/ngx_hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index 0c7285202..74d89b8b9 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -277,7 +277,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
start = nelts / (bucket_size / (2 * sizeof(void *)));
start = start ? start : 1;
- if (hinit->max_size > 10000 && hinit->max_size / nelts < 100) {
+ if (hinit->max_size > 10000 && nelts && hinit->max_size / nelts < 100) {
start = hinit->max_size - 1000;
}