Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1455

TBinaryProtocolT<Transport_>::writeString casts from size_t to uint32_t, which is not safe on 64-bit platforms

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.2
    • Component/s: C++ - Library
    • Labels:
      None
    • Environment:

      gcc 4.4.4, 64 bit Linux (with -Werror and -Wconversion compile flags)

      Description

      The first line in this method sets the size based on the string length, which is of size_t type. On a 64-bit platform, the cast from a 64 bit unsigned integer to a 32 bit unsigned integer can result in incomplete data being written.

      With my compiler flags (-Werror and -Wconversion), I can't compile my code that includes the client library headers.

        Attachments

          Activity

            People

            • Assignee:
              ben.craig Ben Craig
              Reporter:
              rcallawa@us.ibm.com Bob Callaway
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: