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

Segmentation Fault when using BinaryProtocolAccelerated in Ruby

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.2
    • Ruby - Library
    • None
    • Linux 2.6.31-4-generic, Ruby 1.8.7, Thrift r807972

    • Patch Available

    Description

      When using the BinaryProtocolAccelerated in Ruby, and expecting a map<string,string> and getting something else, a segmentation fault occurs. I was able to trace the segmentation fault back to binary_protocol_accelerated.c, in r807972, the problem is in RSTRING_LEN(str) inside write_string_direct(...).

      Notice that, in the Python implementation, or when using BinaryProtocol as opposed to BinaryProtocolAccelerated, an exception is raised when a value has a type other than string in a map<string, string>.

      Attached is a patch that solved the problem for me, please advise on whether or not this would be the right way to solve it (it appears to work properly in different cases).

      Also, attached is a set of files that can be used to reproduce the segmentation fault mentioned.

      Attachments

        1. client.rb
          0.4 kB
          Sinan Taifour
        2. server.rb
          0.6 kB
          Sinan Taifour
        3. test.thrift
          0.1 kB
          Sinan Taifour
        4. thrift-r807972-patch.diff
          0.5 kB
          Sinan Taifour

        Activity

          People

            staii Sinan Taifour
            staii Sinan Taifour
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: