[ 
https://issues.apache.org/jira/browse/TS-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15047926#comment-15047926
 ] 

ASF GitHub Bot commented on TS-4062:
------------------------------------

GitHub user masaori335 opened a pull request:

    https://github.com/apache/trafficserver/pull/370

    TS-4062: Fix CID 1341763 & 1341764

    [TS-4062](https://issues.apache.org/jira/browse/TS-4062)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/masaori335/trafficserver TS-4062

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/370.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #370
    
----
commit 9117a4dac161d8a393ac6c53e5b02b67a91502f6
Author: Masaori Koshiba <[email protected]>
Date:   2015-12-09T02:28:06Z

    TS-4062: CID 1341764: Remove DEADCODE
    
    This DEADCODE will be restored in TS-4061

commit 0e863bf2ae685c540d6573846529a215b15dfc0e
Author: Masaori Koshiba <[email protected]>
Date:   2015-12-09T02:29:20Z

    TS-4062: CID 1341763: Free data when error

----


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

Reply via email to