This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 6c9e23d7a1 Coverity 1497350: Wrapper object use after free in
GzipDeflateTransformation (#10879)
6c9e23d7a1 is described below
commit 6c9e23d7a1f90e6814ce501794e6ec32dd75a389
Author: Bryan Call <[email protected]>
AuthorDate: Mon Dec 4 15:59:13 2023 -0800
Coverity 1497350: Wrapper object use after free in
GzipDeflateTransformation (#10879)
Ignore false positive
---
src/tscpp/api/GzipDeflateTransformation.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/tscpp/api/GzipDeflateTransformation.cc
b/src/tscpp/api/GzipDeflateTransformation.cc
index 772d0b9145..c540aacf97 100644
--- a/src/tscpp/api/GzipDeflateTransformation.cc
+++ b/src/tscpp/api/GzipDeflateTransformation.cc
@@ -104,12 +104,14 @@ GzipDeflateTransformation::consume(std::string_view data)
do {
LOG_DEBUG("Iteration %d: Deflate will compress %ld bytes", ++iteration,
data.size());
state_->z_stream_.avail_out = buffer_size;
- state_->z_stream_.next_out = &buffer[0];
+ // next_out needs to be set to nullptr before we return since it points to
a local buffer
+ // coverity[WRAPPER_ESCAPE: FALSE]
+ state_->z_stream_.next_out = &buffer[0];
int err = deflate(&state_->z_stream_, Z_SYNC_FLUSH);
if (Z_OK != err) {
- state_->z_stream_.next_out = nullptr;
LOG_ERROR("Iteration %d: Deflate failed to compress %ld bytes with error
code '%d'", iteration, data.size(), err);
+ state_->z_stream_.next_out = nullptr;
return;
}