Nginx 0.8.34 segmentation fault

Maxim Dounin mdounin at mdounin.ru
Thu Mar 25 05:36:34 MSK 2010


Hello!

On Wed, Mar 10, 2010 at 09:45:25AM +0100, Hoang Hoang wrote:

> Hoang Hoang wrote:
> > Hi all,
> > 
> > I tried to put the following directive into http {}
> > 
> >     proxy_cache_path  /usr/local/nginx/proxy_temp levels=1:2
> 
> Hi Igor
> 
> Here is the backtrace I get from gdb
> 
> (gdb) run
> Starting program: /usr/local/nginx/sbin/nginx -t
> [Thread debugging using libthread_db enabled]
> [New Thread 182896549120 (LWP 31420)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 182896549120 (LWP 31420)]
> ngx_vslprintf (buf=0x7fbfffec64 "", last=0x7fbffff030 "`Õ`K7", 
> fmt=0x46b77c "s:%ui has the different levels than", args=0x7fbfffec10) 
> at src/core/ngx_string.c:256
> 256                             *buf++ = *p++;

Patch attached.

Maxim Dounin
-------------- next part --------------
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1269484456 -10800
# Node ID 50b398f546517eba23acdff54de219582c8a6ad5
# Parent  274487742eb498199b17afdcb0274830c43ac077
Cache: correctly set conf_file while adding paths.

Missing conf_file causes incorrect error messages in ngx_add_path() and may
lead to segmentation fault while reading configuration.

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -1591,6 +1591,8 @@ ngx_http_file_cache_set_slot(ngx_conf_t 
     cache->path->manager = ngx_http_file_cache_manager;
     cache->path->loader = ngx_http_file_cache_loader;
     cache->path->data = cache;
+    cache->path->conf_file = cf->conf_file->file.name.data;
+    cache->path->line = cf->conf_file->line;
 
     if (ngx_add_path(cf, &cache->path) != NGX_OK) {
         return NGX_CONF_ERROR;


More information about the nginx mailing list