Skip to content

Commit

Permalink
Fix crash from nullptr during read after request free
Browse files Browse the repository at this point in the history
return NGX_OK instead
  • Loading branch information
splitice committed May 30, 2023
1 parent ed5decf commit 920102e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ngx_http_lua_io_input_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ ngx_http_lua_io_read_chunk(void *data, ngx_buf_t *buf, size_t size)
return NGX_OK;
}

if(file_ctx->buf_in == NULL) {
return NGX_OK;
}

if (size >= rest) {
buf->pos += rest;
file_ctx->buf_in->buf->last += rest;
Expand Down Expand Up @@ -64,6 +68,10 @@ ngx_http_lua_io_read_line(void *data, ngx_buf_t *buf, size_t size)

#endif

if(file_ctx->buf_in == NULL) {
return NGX_OK;
}

while (size--) {

c = *buf->pos++;
Expand Down Expand Up @@ -98,6 +106,10 @@ ngx_http_lua_io_read_all(void *data, ngx_buf_t *buf, size_t size)
{
ngx_http_lua_io_file_ctx_t *file_ctx = data;

if(file_ctx->buf_in == NULL) {
return NGX_OK;
}

file_ctx->buf_in->buf->last += size;
buf->pos += size;

Expand Down

0 comments on commit 920102e

Please sign in to comment.