[
https://issues.apache.org/jira/browse/TS-3822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659309#comment-14659309
]
Masaori Koshiba commented on TS-3822:
-------------------------------------
We should check the {{stream}} is NULL or not after finding the {{stream}}. The
purpose of it is checking if the state of {{stream}} is {{IDLE}} or {{CLOSED}}.
( Details in
https://github.com/apache/trafficserver/blob/master/proxy/http2/Http2ConnectionState.h#L294
)
And the commit
[{{0fc4dcdea9449929c440e54d301144edefbb721f}}|https://github.com/apache/trafficserver/commit/0fc4dcdea9449929c440e54d301144edefbb721f#diff-627ff265c15ee1f074eeecbb006aad53L172]
for TS-3497 deleted the check.
[~maskit] Do you have any reason to delete the NULL check?
> clang-analyzer: Value stored to 'stream' during its initialization is never
> read
> --------------------------------------------------------------------------------
>
> Key: TS-3822
> URL: https://issues.apache.org/jira/browse/TS-3822
> Project: Traffic Server
> Issue Type: Bug
> Components: HTTP/2
> Reporter: Leif Hedstrom
> Assignee: Leif Hedstrom
> Fix For: 6.0.0
>
>
> Http2Stream *stream = cstate.find_stream(id);
> Value stored to 'stream' during its initialization is never read
> Assuming the code is correct, I suggest the following patch:
> {code}
> diff --git a/proxy/http2/Http2ConnectionState.cc
> b/proxy/http2/Http2ConnectionState.cc
> index 4244468..3d94dfd 100644
> --- a/proxy/http2/Http2ConnectionState.cc
> +++ b/proxy/http2/Http2ConnectionState.cc
> @@ -173,13 +173,13 @@ rcv_headers_frame(Http2ClientSession &cs,
> Http2ConnectionState &cstate, const Ht
> return Http2Error(HTTP2_ERROR_CLASS_CONNECTION,
> HTTP2_ERROR_PROTOCOL_ERROR);
> }
>
> - Http2Stream *stream = cstate.find_stream(id);
> if (id <= cstate.get_latest_stream_id()) {
> return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_STREAM_CLOSED);
> }
>
> // Create new stream
> - stream = cstate.create_stream(id);
> + Http2Stream *stream = cstate.create_stream(id);
> +
> if (!stream) {
> return Http2Error(HTTP2_ERROR_CLASS_CONNECTION,
> HTTP2_ERROR_PROTOCOL_ERROR);
> }
> {code}
> [~masaori], [~rokubo] or [~maskit] Does that seem reasonable?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)