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

TCompactProtocol in C# lib does not serialize and deserialize negative int32 and int64 number correctly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9
    • Fix Version/s: 0.9.1
    • Component/s: C# - Library
    • Labels:
    • Environment:

      Windows

    • Patch Info:
      Patch Available

      Description

      longToZigzag and ZigzagToLong in TCompactProtocol does not perform corresponding operations to serialize and deserialize negative int32 and int64 number correctly. Purpose to change longToZigzag from (ulong)(((ulong)n << 1) ^ ((ulong)n >> 63)) to (ulong)(n << 1) ^ (ulong)(n >> 63).

      Will need to do same for intToZigZag. The reason is that we want arithmetic shift not logic shift.

      The test case in the project shows this, the output on server and client are different even though client received the same number back.

        Attachments

        1. thrift-1973-TCompactProtocol-Fix.patch
          1 kB
          Eric Ding
        2. 1973-test-suite.patch
          12 kB
          Carl Yeksigian
        3. 1973-test-suite-v2.patch
          14 kB
          Carl Yeksigian

          Issue Links

            Activity

              People

              • Assignee:
                henrique Henrique Mendonca
                Reporter:
                eding Eric Ding
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: