You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (JIRA)" <ji...@apache.org> on 2015/12/08 19:46:11 UTC

[jira] [Updated] (TS-4062) CID 1341764, 1341763 Control flow issues and resource leak in H2

     [ https://issues.apache.org/jira/browse/TS-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Hedstrom updated TS-4062:
------------------------------
    Fix Version/s: 6.1.0

> 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
>              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)