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

Bug in list deserializer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9
    • 0.9.1
    • C glib - Compiler
    • Linux x86, glib 2.34 (latest)

    • Patch Available

    Description

      The function generate_deserialize_list_element() has a functional bug. It uses the following code to append a new element while deserializing.

      out << "g_array_append_val (" << prefix << ", " << elem << ");" << endl

      g_array_append_val() is a macro is glib which expects an array element, whereas "elem" in generate_deserialize_list_element() is a pointer to the array element. Deserialization doesn't work because of it. I don't think this part of the code was ever tested. I don't see any test or example code in c_glib which use lists.

      One way to fix this is to use the glib API g_array_append_vals() instead. (BTW, g_array_append_val() is a wrapper macro which uses g_array_append_vals() internally). I'll attach the patch. It's been tested already.

      Attachments

        1. thrift-0.9.0-fix-THRIFT-1831.patch
          0.7 kB
          Satheesh Velmurugan

        Activity

          People

            Unassigned Unassigned
            sath33sh Satheesh Velmurugan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: