]> git.kaiwu.me - nginx.git/commit
Map: fixed regex pattern lifetime
authorRoman Arutyunyan <arut@nginx.com>
Fri, 6 Nov 2026 11:47:47 +0000 (15:47 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Fri, 6 Nov 2026 17:04:11 +0000 (21:04 +0400)
commitd17f1d249d386de1282222172f526973fcd8a702
tree1b54b71a8a3acc23a21d712a11f271c066af9dee
parent62f94cf696cddc8c3e68a957cc52191a316621b1
Map: fixed regex pattern lifetime

The regex pattern was referenced from the temporary pool used for
map block parsing, which is destroyed once the block is parsed.  The
pattern is later used for logging if regex matching fails, e.g., due
to PCRE2 match limit, JIT stack limit, or invalid UTF-8 with (*UTF),
resulting in released memory being logged.

The fix is to copy the pattern into the configuration pool.
src/http/modules/ngx_http_map_module.c
src/stream/ngx_stream_map_module.c