]> git.kaiwu.me - nginx.git/commit
Merge of r4965: upstream: fixed SIGSEGV with the "if" directive.
authorMaxim Dounin <mdounin@mdounin.ru>
Sun, 10 Feb 2013 03:27:15 +0000 (03:27 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Sun, 10 Feb 2013 03:27:15 +0000 (03:27 +0000)
commit244b6659ec7bff5e85814ab8be272ebe47ef24b8
treee5bfcb438cd0d1861d609631bab895511f2432f6
parent1e0ed6da525a1f8e1440560fdf15940a2fa2df37
Merge of r4965: upstream: fixed SIGSEGV with the "if" directive.

Configuration like

    location / {
        set $true 1;

        if ($true) {
            proxy_pass http://backend;
        }

        if ($true) {
            # nothing
        }
    }

resulted in segmentation fault due to NULL pointer dereference as the
upstream configuration wasn't initialized in an implicit location created
by the last if(), but the r->content_handler was set due to first if().

Instead of committing a suicide by dereferencing a NULL pointer, return
500 (Internal Server Error) in such cases, i.e. if uscf is NULL.  Better
fix would be to avoid such cases by fixing the "if" directive handling,
but it's out of scope of this patch.

Prodded by Piotr Sikora.
src/http/ngx_http_upstream.c