diff options
| author | Andrew Clayton <a.clayton@nginx.com> | 2025-08-11 22:26:31 +0100 |
|---|---|---|
| committer | Andrew Clayton <a.clayton@nginx.com> | 2025-08-20 13:55:59 +0100 |
| commit | 5e97e44df4bf80ee6914c3fe42c57d6c674c3279 (patch) | |
| tree | e993136c091969e8a0c26cf8fc210848a4c7455a /src | |
| parent | 6482e46a6b35214967095169842e1d5403a01d4d (diff) | |
| download | unit-5e97e44df4bf80ee6914c3fe42c57d6c674c3279.tar.gz unit-5e97e44df4bf80ee6914c3fe42c57d6c674c3279.tar.bz2 | |
http: compression: Add a missed nxt_http_comp_compress() return check
In nxt_http_comp_compress_static_response() we should check the return
value of the call to nxt_http_comp_compress() in case of error.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/nxt_http_compression.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nxt_http_compression.c b/src/nxt_http_compression.c index 4f4eec1a..f9a94d05 100644 --- a/src/nxt_http_compression.c +++ b/src/nxt_http_compression.c @@ -305,6 +305,12 @@ nxt_http_comp_compress_static_response(nxt_task_t *task, nxt_http_request_t *r, cbytes = nxt_http_comp_compress(out + *out_total, out_size - *out_total, in + in_size - rest, n, last); + if (cbytes == -1) { + nxt_file_close(task, &tfile); + nxt_mem_munmap(in, in_size); + nxt_mem_munmap(out, out_size); + return NXT_ERROR; + } *out_total += cbytes; rest -= n; |
