Skip to content

Commit 9dcb8be

Browse files
committed
Disallow the changing of jit_stack_size once regex cache is populated
1 parent 16a5eaf commit 9dcb8be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/resty/core/regex.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ function ngx.re.opt(option, value)
169169
if option == "jit_stack_size" then
170170
local result = C.ngx_http_lua_set_jit_stack_size(value)
171171

172-
if result ~= 0 then
172+
if result == -1 then
173+
return error("Changing jit stack size is not allowed when " ..
174+
"regexs have already been compiled and cached")
175+
elseif result == -2 then
173176
return error("PCRE jit stack allocation failed")
174177
end
175178

0 commit comments

Comments
 (0)