Skip to content

Commit 920102e

Browse files
committed
Fix crash from nullptr during read after request free
return NGX_OK instead
1 parent ed5decf commit 920102e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ngx_http_lua_io_input_filter.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ ngx_http_lua_io_read_chunk(void *data, ngx_buf_t *buf, size_t size)
2525
return NGX_OK;
2626
}
2727

28+
if(file_ctx->buf_in == NULL) {
29+
return NGX_OK;
30+
}
31+
2832
if (size >= rest) {
2933
buf->pos += rest;
3034
file_ctx->buf_in->buf->last += rest;
@@ -64,6 +68,10 @@ ngx_http_lua_io_read_line(void *data, ngx_buf_t *buf, size_t size)
6468

6569
#endif
6670

71+
if(file_ctx->buf_in == NULL) {
72+
return NGX_OK;
73+
}
74+
6775
while (size--) {
6876

6977
c = *buf->pos++;
@@ -98,6 +106,10 @@ ngx_http_lua_io_read_all(void *data, ngx_buf_t *buf, size_t size)
98106
{
99107
ngx_http_lua_io_file_ctx_t *file_ctx = data;
100108

109+
if(file_ctx->buf_in == NULL) {
110+
return NGX_OK;
111+
}
112+
101113
file_ctx->buf_in->buf->last += size;
102114
buf->pos += size;
103115

0 commit comments

Comments
 (0)