Welcome! Log In Create A New Profile

Advanced

A bug with geo module which may cause Nginx segment fault.

姚伟斌
August 16, 2012 04:48AM
Hi,

We found a bug with geo module. If you use geo module with range
directive, but you don't add the default directive, it'll cause a
segment fault.

The test configure is like this:

http {

geo $geo {
ranges;
10.0.0.1-10.0.0.1 1;
}

server {
listen 80;

location / {
set $test $geo;
root html;
index index.html index.htm;
}
}

}


The reason is that configure structure value is assigned to the geo
structure before the default value initialized. You can see the code
in the geo module:

geo->u.high = ctx.high;

var->get_handler = ngx_http_geo_range_variable;
var->data = (uintptr_t) geo;

if (ctx.high.default_value == NULL) {
ctx.high.default_value = &ngx_http_variable_null_value;
}

The variable of ctx is allocated by stack. And the member variable
ctx.high is structure, not a pointer.


The attachment is our patch for this bug. The man who first found
this bug is Zhen Chen ( gongyuan.cz@taobao.com ) in our team.

Thanks.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

A bug with geo module which may cause Nginx segment fault. Attachments

姚伟斌 1393 August 16, 2012 04:48AM

Re: A bug with geo module which may cause Nginx segment fault.

Maxim Dounin 454 August 16, 2012 09:04AM

Re: A bug with geo module which may cause Nginx segment fault.

姚伟斌 665 August 16, 2012 10:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 106
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready