nginx-0.3.17 amd64 patch

Igor Sysoev is at rambler-co.ru
Mon Dec 19 21:27:08 MSK 2005


Патч решает следующую проблему в 0.3.16 и 0.3.17:
на 64-битных платформах nginx при запуске мог упасть.


Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
--- src/core/ngx_hash.c	Sat Dec 17 20:06:42 2005
+++ src/core/ngx_hash.c	Mon Dec 19 21:06:53 2005
@@ -170,7 +170,7 @@
 
     for (size = start; size < hinit->max_size; size++) {
 
-        ngx_memzero(test, size * sizeof(ngx_uint_t));
+        ngx_memzero(test, size * sizeof(size_t));
 
         for (n = 0; n < nelts; n++) {
             if (names[n].key.data == NULL) {
@@ -347,7 +347,7 @@
 ngx_hash_wildcard_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names,
     ngx_uint_t nelts)
 {
-    size_t                len;
+    size_t                len, dot_len;
     ngx_uint_t            i, n, dot;
     ngx_array_t           curr_names, next_names;
     ngx_hash_key_t       *name, *next_name;
@@ -396,9 +396,11 @@
 
 #if 0
         ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
-                      "wc1: \"%V\"", &name->key);
+                      "wc1: \"%V\" %ui", &name->key, dot);
 #endif
 
+        dot_len = len + 1;
+
         if (dot) {
             len++;
         }
@@ -432,8 +434,8 @@
                 return NGX_ERROR;
             }
 
-            next_name->key.len = names[i].key.len - len;
-            next_name->key.data = names[i].key.data + len;
+            next_name->key.len = names[i].key.len - dot_len;
+            next_name->key.data = names[i].key.data + dot_len;
             next_name->key_hash= 0;
             next_name->value = names[i].value;
 
--- auto/os/conf	Fri Dec  9 15:44:46 2005
+++ auto/os/conf	Mon Dec 19 21:09:13 2005
@@ -64,7 +64,7 @@
         NGX_MACH_CACHE_LINE=32
     ;;
 
-    amd64)
+    amd64 | x86_64)
         have=NGX_HAVE_NONALIGNED . auto/have
         NGX_MACH_CACHE_LINE=64
     ;;


More information about the nginx-ru mailing list