$request_uri greater than 8 characters causes core dump

Nginx dumps core if the $request_uri is not found and is more than 8
characters. For example:

$ GET -Sed http://localhost/en/12345
GET http://localhost/en/12345
200 OK
Connection: close
Date: Sun, 14 Oct 2012 23:13:40 GMT
Accept-Ranges: bytes
Server: nginx/1.1.19
Content-Length: 4464
Content-Type: text/html
Last-Modified: Sun, 14 Oct 2012 22:21:45 GMT
Client-Date: Sun, 14 Oct 2012 23:13:40 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
Title: Page Not Found :frowning:
X-Meta-Charset: utf-8

$ GET -Sed http://localhost/en/123456
GET http://localhost/en/123456
500 Server closed connection without sending any data back
Content-Type: text/plain
Client-Date: Sun, 14 Oct 2012 23:13:43 GMT
Client-Warning: Internal response

But a longer $request_uri that is found is OK. For example:

$ GET -Sed http://localhost/en/about/index.html
GET http://localhost/en/about/index.html
200 OK
Connection: close
Date: Sun, 14 Oct 2012 23:15:20 GMT
Accept-Ranges: bytes
Server: nginx/1.1.19
Content-Length: 3050
Content-Type: text/html
Last-Modified: Sun, 14 Oct 2012 19:37:32 GMT
Client-Date: Sun, 14 Oct 2012 23:15:20 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
Title:
X-Meta-Author:
X-Meta-Charset: utf-8

This is on Ubuntu 12.04 x86 64-bit with nginx 1.1.19 (the nginx-light
package).

This is my setup:

server {
    listen 80;
    server_name localhost;

    root /srv/www/site;
    index index.html;

    error_page 404 = @404;

    location @404 {
        try_files /404.html /404/index.html;
    }

    location ~ ^/(404|css|js|font|img|en|es) {
        try_files $uri $uri/ =404;
    }

    location / {
        rewrite ^ 

$scheme://$server_name:$server_port/en$request_uri?
redirect;
}
}

What in the world? Thanks.

-Tom

Posted at Nginx Forum:

On Monday 15 October 2012 03:21:46 tvaughan wrote:

Nginx dumps core if the $request_uri is not found and is more than 8
characters. For example:

[…]

This is on Ubuntu 12.04 x86 64-bit with nginx 1.1.19 (the nginx-light
package).

[…]

What in the world? Thanks.

You use an old nginx version from development branch with well-known
bug.

wbr, Valentin V. Bartenev