Skip to content

Commit 4070709

Browse files
authored
bugfix: avoid truncating Lua context in filters.
The request context was widened from uint16_t to uint32_t when phase flags grew beyond 16 bits, but the header and body filters continued saving it in a uint16_t old_context variable. Contexts above 0xffff were truncated while running a filter and restored as zero afterward. Use uint32_t for old_context to preserve the complete phase value.
1 parent 81d7022 commit 4070709

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/ngx_http_lua_bodyfilterby.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ ngx_http_lua_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
241241
ngx_http_lua_loc_conf_t *llcf;
242242
ngx_http_lua_ctx_t *ctx;
243243
ngx_int_t rc;
244-
uint16_t old_context;
244+
uint32_t old_context;
245245
ngx_pool_cleanup_t *cln;
246246
ngx_chain_t *out;
247247
ngx_chain_t *cl, *ln;

‎src/ngx_http_lua_headerfilterby.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ ngx_http_lua_header_filter(ngx_http_request_t *r)
240240
ngx_http_lua_ctx_t *ctx;
241241
ngx_int_t rc;
242242
ngx_pool_cleanup_t *cln;
243-
uint16_t old_context;
243+
uint32_t old_context;
244244

245245
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
246246
"lua header filter for user lua code, uri \"%V\"", &r->uri);

0 commit comments

Comments
 (0)