Satheesh Velmurugan created THRIFT-1831:
-------------------------------------------

             Summary: Bug in list deserializer
                 Key: THRIFT-1831
                 URL: https://issues.apache.org/jira/browse/THRIFT-1831
             Project: Thrift
          Issue Type: Bug
          Components: C glib - Compiler
    Affects Versions: 0.9
         Environment: Linux x86, glib 2.34 (latest)
            Reporter: Satheesh Velmurugan


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.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to