[
https://issues.apache.org/jira/browse/TS-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15049833#comment-15049833
]
ASF subversion and git services commented on TS-4062:
-----------------------------------------------------
Commit 88c35d77a8897325f0cecfc4c844938bbffa6035 in trafficserver's branch
refs/heads/master from [~masaori]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=88c35d7 ]
TS-4062: CID 1341763: Free data when error
This closes #370
> CID 1341764, 1341763 Control flow issues and resource leak in H2
> ----------------------------------------------------------------
>
> Key: TS-4062
> URL: https://issues.apache.org/jira/browse/TS-4062
> Project: Traffic Server
> Issue Type: Bug
> Components: HTTP/2
> Reporter: Leif Hedstrom
> Assignee: Masaori Koshiba
> Priority: Critical
> Labels: coverity
> Fix For: 6.1.0
>
>
> {code}
> New defect(s) Reported-by: Coverity Scan
> Showing 2 of 2 defect(s)
> ** CID 1341764: Possible Control flow issues (DEADCODE)
> /proxy/http2/HPACK.cc: 347 in encode_string(unsigned char *, const unsigned
> char *, const char *, unsigned long)()
> ________________________________________________________________________________________________________
> *** CID 1341764: Possible Control flow issues (DEADCODE)
> /proxy/http2/HPACK.cc: 347 in encode_string(unsigned char *, const unsigned
> char *, const char *, unsigned long)()
> 341 if (use_huffman) {
> 342 data = static_cast<char *>(ats_malloc(value_len * 4));
> 343 if (data == NULL)
> 344 return -1;
> 345 data_len = huffman_encode(reinterpret_cast<uint8_t *>(data),
> reinterpret_cast<const uint8_t *>(value), value_len);
> 346 } else {
> CID 1341764: Possible Control flow issues (DEADCODE)
> Execution cannot reach this statement: "data = (char *)value;".
> 347 data = const_cast<char *>(value);
> 348 data_len = value_len;
> 349 }
> 350
> 351 // Length
> 352 const int64_t len = encode_integer(p, buf_end, data_len, 7);
> ** CID 1341763: (RESOURCE_LEAK)
> /proxy/http2/HPACK.cc: 354 in encode_string(unsigned char *, const unsigned
> char *, const char *, unsigned long)()
> /proxy/http2/HPACK.cc: 360 in encode_string(unsigned char *, const unsigned
> char *, const char *, unsigned long)()
> ________________________________________________________________________________________________________
> *** CID 1341763: (RESOURCE_LEAK)
> /proxy/http2/HPACK.cc: 354 in encode_string(unsigned char *, const unsigned
> char *, const char *, unsigned long)()
> 348 data_len = value_len;
> 349 }
> 350
> 351 // Length
> 352 const int64_t len = encode_integer(p, buf_end, data_len, 7);
> 353 if (len == -1)
> CID 1341763: (RESOURCE_LEAK)
> Variable "data" going out of scope leaks the storage it points to.
> 354 return -1;
> 355 if (use_huffman) {
> 356 *p |= 0x80;
> 357 }
> 358 p += len;
> 359 if (buf_end < p || buf_end - p < data_len)
> /proxy/http2/HPACK.cc: 360 in encode_string(unsigned char *, const unsigned
> char *, const char *, unsigned long)()
> 354 return -1;
> 355 if (use_huffman) {
> 356 *p |= 0x80;
> 357 }
> 358 p += len;
> 359 if (buf_end < p || buf_end - p < data_len)
> CID 1341763: (RESOURCE_LEAK)
> Variable "data" going out of scope leaks the storage it points to.
> 360 return -1;
> 361
> 362 // Value
> 363 memcpy(p, data, data_len);
> 364 p += data_len;
> 365
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)