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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9
    • 0.9.1
    • C# - Library
    • Windows

    • 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. 1973-test-suite.patch
          12 kB
          Carl Yeksigian
        2. 1973-test-suite-v2.patch
          14 kB
          Carl Yeksigian
        3. thrift-1973-TCompactProtocol-Fix.patch
          1 kB
          Eric Ding

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: