Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-3822

clang-analyzer: Value stored to 'stream' during its initialization is never read

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 6.0.0
    • HTTP/2
    • None

    Description

      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:

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

      masaori, rokubo or maskit Does that seem reasonable?

      Attachments

        Activity

          People

            zwoop Leif Hedstrom
            zwoop Leif Hedstrom
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: