This is an automated email from the ASF dual-hosted git repository.
amc 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 fac6099 clang-analyzer: fix bogus use after free with Ptr in
LogFieldInt constructor.
fac6099 is described below
commit fac60997df2437c3a0d853e6d770c960a85dbf75
Author: Alan M. Carroll <[email protected]>
AuthorDate: Mon May 13 16:01:40 2019 -0500
clang-analyzer: fix bogus use after free with Ptr in LogFieldInt
constructor.
---
proxy/logging/LogFilter.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/proxy/logging/LogFilter.cc b/proxy/logging/LogFilter.cc
index 8b85394..b80887d 100644
--- a/proxy/logging/LogFilter.cc
+++ b/proxy/logging/LogFilter.cc
@@ -526,13 +526,16 @@ LogFilterInt::LogFilterInt(const char *name, LogField
*field, LogFilter::Action
size_t i = 0;
SimpleTokenizer tok(values, ',');
size_t n = tok.getNumTokensRemaining();
+ auto field_map{field->map()}; // because clang-analyzer freaks out if this
is inlined.
+ // It doesn't realize the value is held in
place by the smart
+ // pointer in @c field.
if (n) {
val_array = new int64_t[n];
char *t;
while (t = tok.getNext(), t != nullptr) {
int64_t ival;
- if (!_convertStringToInt(t, &ival, field->map().get())) {
+ if (!_convertStringToInt(t, &ival, field_map.get())) {
// conversion was successful, add entry to array
//
val_array[i++] = ival;