openresty / openresty/lua-nginx-module
Missing error checks for the `ngx_http_lua_coroutine_create_helper` function call
Open
@thibaultcha is already working on this.
Since Jul 20, 2020.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
The clang static analyzer found a call of ngx_http_lua_coroutine_create_helper missing error handling:
src/ngx_http_lua_coroutine.c:97:20: warning: Access to field 'is_wrap' results in a dereference of a null pointer (loaded from variable 'coctx')
coctx->is_wrap = 1;
~~~~~ ^
1 warning generated.
The corresponding code snippets is like this:
95 ngx_http_lua_coroutine_create_helper(L, r, ctx, &coctx);
96
97 coctx->is_wrap = 1;
git blame shows the following:
9a892b8d5 (Thibault Charbonnier 2018-01-17 22:20:44 -0800 95) ngx_http_lua_coroutine_create_helper(L, r, ctx, &coctx);
9a892b8d5 (Thibault Charbonnier 2018-01-17 22:20:44 -0800 96)
9a892b8d5 (Thibault Charbonnier 2018-01-17 22:20:44 -0800 97) coctx->is_wrap = 1;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.