changeset 640:97a1e05203c2 NGINX_1_0_10

nginx 1.0.10 *) Bugfix: a segmentation fault might occur in a worker process if resolver got a big DNS response. Thanks to Ben Hawkes. *) Bugfix: in cache key calculation if internal MD5 implementation was used; the bug had appeared in 1.0.4. *) Bugfix: the module ngx_http_mp4_module sent incorrect "Content-Length" response header line if the "start" argument was used. Thanks to Piotr Sikora.
author Igor Sysoev <http://sysoev.ru>
date Tue, 15 Nov 2011 00:00:00 +0400
parents 6a2ff3b3f4c4
children e21c9e01ce08
files CHANGES CHANGES.ru src/core/nginx.h src/core/ngx_md5.c src/core/ngx_resolver.c src/http/modules/ngx_http_mp4_module.c src/http/modules/perl/nginx.pm
diffstat 7 files changed, 43 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,19 @@
 
+Changes with nginx 1.0.10                                        15 Nov 2011
+
+    *) Bugfix: a segmentation fault might occur in a worker process if
+       resolver got a big DNS response.
+       Thanks to Ben Hawkes.
+
+    *) Bugfix: in cache key calculation if internal MD5 implementation was
+       used; the bug had appeared in 1.0.4.
+
+    *) Bugfix: the module ngx_http_mp4_module sent incorrect
+       "Content-Length" response header line if the "start" argument was
+       used.
+       Thanks to Piotr Sikora.
+
+
 Changes with nginx 1.0.9                                         01 Nov 2011
 
     *) Change: now the 0x7F-0x1F characters are escaped as \xXX in an
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,18 @@
 
+Изменения в nginx 1.0.10                                          15.11.2011
+
+    *) Исправление: в рабочем процессе мог произойти segmentation fault,
+       если resolver получил большой DNS-ответ.
+       Спасибо Ben Hawkes.
+
+    *) Исправление: в вычислении ключа для кэширования, если использовалась
+       внутренняя реализация MD5; ошибка появилась в 1.0.4.
+
+    *) Исправление: модуль ngx_http_mp4_module выдавал неверную строку
+       "Content-Length" в заголовке ответа, использовался аргумент start.
+       Спасибо Piotr Sikora.
+
+
 Изменения в nginx 1.0.9                                           01.11.2011
 
     *) Изменение: теперь символы 0x7F-0xFF в access_log записываются в виде
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version      1000009
-#define NGINX_VERSION      "1.0.9"
+#define nginx_version      1000010
+#define NGINX_VERSION      "1.0.10"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_md5.c
+++ b/src/core/ngx_md5.c
@@ -47,7 +47,8 @@ ngx_md5_update(ngx_md5_t *ctx, const voi
             return;
         }
 
-        data = ngx_cpymem(&ctx->buffer[used], data, free);
+        ngx_memcpy(&ctx->buffer[used], data, free);
+        data = (u_char *) data + free;
         size -= free;
         (void) ngx_md5_body(ctx, ctx->buffer, 64);
     }
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -1922,7 +1922,13 @@ done:
     n = *src++;
 
     for ( ;; ) {
-        if (n != 0xc0) {
+        if (n & 0xc0) {
+            n = ((n & 0x3f) << 8) + *src;
+            src = &buf[n];
+
+            n = *src++;
+
+        } else {
             ngx_memcpy(dst, src, n);
             dst += n;
             src += n;
@@ -1932,12 +1938,6 @@ done:
             if (n != 0) {
                 *dst++ = '.';
             }
-
-        } else {
-            n = ((n & 0x3f) << 8) + *src;
-            src = &buf[n];
-
-            n = *src++;
         }
 
         if (n == 0) {
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -1066,7 +1066,6 @@ ngx_http_mp4_update_mdat_atom(ngx_http_m
 
     atom_data_size = mp4->mdat_data.buf->file_last - start_offset;
     mp4->mdat_data.buf->file_pos = start_offset;
-    mp4->content_length += atom_data_size;
 
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
                    "mdat new offset @%O:%O", start_offset, atom_data_size);
@@ -1083,6 +1082,8 @@ ngx_http_mp4_update_mdat_atom(ngx_http_m
         atom_header_size = sizeof(ngx_mp4_atom_header_t);
     }
 
+    mp4->content_length += atom_header_size + atom_data_size;
+
     ngx_mp4_set_32value(atom_header, atom_size);
     ngx_mp4_set_atom_name(atom_header, 'm', 'd', 'a', 't');
 
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -48,7 +48,7 @@ our @EXPORT = qw(
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '1.0.9';
+our $VERSION = '1.0.10';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);