]> git.kaiwu.me - nginx.git/commitdiff
Handle predicate location variable error
authorRoman Arutyunyan <arut@nginx.com>
Wed, 9 Sep 2026 13:32:34 +0000 (17:32 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Wed, 9 Sep 2026 15:37:03 +0000 (19:37 +0400)
Previously, the error was ignored and the predicate was treated as
false.  Now the error leads to the request finalization.

src/http/ngx_http_core_module.c

index cfadaa7c0a33128769a714cfceb959efbec5a3b5..1bd8a55ab3c72a224c9f926da1f66817bc14a04e 100644 (file)
@@ -1514,8 +1514,11 @@ ngx_http_core_find_location(ngx_http_request_t *r)
                            "test location: \"%V\"", &(*clcfp)->name);
 
             vv = ngx_http_get_flushed_variable(r, (*clcfp)->predicate - 1);
+            if (vv == NULL) {
+                return NGX_ERROR;
+            }
 
-            if (vv && vv->len && (vv->len != 1 || vv->data[0] != '0')) {
+            if (vv->len && (vv->len != 1 || vv->data[0] != '0')) {
                 r->loc_conf = (*clcfp)->loc_conf;
 
                 /* look up nested locations */