[ 
https://issues.apache.org/jira/browse/THRIFT-1831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13556670#comment-13556670
 ] 

Satheesh Velmurugan commented on THRIFT-1831:
---------------------------------------------

Roger,
Regarding unit test, I can't find test code in c_glib where I can quickly add a 
test case for this patch. The example in THRIFT-847 seems to be specific to 
cpp. Do you have any examples for c_glib?

Thanks,
satheesh
                
> 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
>              Labels: c_glib, list
>         Attachments: thrift-0.9.0-fix-THRIFT-1831.patch
>
>
> 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