Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-10095

TcrConnection::readHandshakeData reads too many bytes

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • None
    • None
    • native client
    • None

    Description

      This method is called to read bytes from a socket, and return said data in a `std::vector<int8_t>`. For some inexplicable (inexcusable?) reason, the method always adds a 0 byte to the end of the vector, as if it were null-terminating a string. So, `readHandshakeData(1)` returns 2 bytes, `readHandshakeData(5)` returns 6 bytes, etc.

      This is extremely misleading, given the name of the method and the fact that the requested number of bytes is a parameter passed in. Also, in no circumstance is this method used to actually read a string, i.e. something that may require null-termination. Please remove the extra byte from the returned vector, and if possible add a unit test to the suite that reads n bytes and asserts that the method always returns n bytes.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mreddington Matthew Reddington
            bbender Blake Bender

            Dates

              Created:
              Updated:

              Slack

                Issue deployment