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

Anatoly Kanivetsky edited comment on THRIFT-1191 at 6/10/11 8:30 AM:
---------------------------------------------------------------------

I'll give an example:

struct TheTest
{
    1: optional i32         field1;
    2: optional list<i32>   field2;
}

A = #theTest{field1=256, field2=[128, 64]}

Simple test is when structure A got serialized, we got:
<<8,0,1,255,255,255,255,15,0,2,8,0,0,0,2,0,0,0,128,0,0,0,129,0>>
 |___this is field 1___|____________this is field 2___________|

Let's then remove field 2 from TheTest structure.
Reading from this binary should skip field 2, but, because of the bug in the 
code, it just throws an exception.

The bug consists of calling thrift_protocol:skip(IProto0, FType) with FType is 
integer, representing the field type. But thrift_protocol:skip accepts the atom 
with type instead of integer.



      was (Author: chaos-ad):
    I'll give an example:

struct TheTest
{
    1: optional i32         field1;
    2: optional list<i32>   field2;
}

A = #theTest{field1=256, field2=[128, 64]}

Simple test is when structure A got serialized, we got:
<<8,0,1,255,255,255,255,15,0,2,8,0,0,0,2,0,0,0,128,0,0,0,129,0>>

Next, if we delete field #2, reading this binary to #theTest again should skip 
removed field.
But because of bug in the code, it fails to read it.

The bug consists of calling thrift_protocol:skip(IProto0, FType) with FType is 
integer, representing the field type. But thrift_protocol:skip accepts the atom 
with type instead of integer.


  
> Erlang binding throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> -------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1191
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1191
>             Project: Thrift
>          Issue Type: Bug
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>         Attachments: THRIFT-1191.patch
>
>
> Erlang binding throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> Here's the pull request with this fix:
> https://github.com/apache/thrift/pull/3 here is the patch
> Here's the fix only:
> https://github.com/chaos-ad/thrift/commit/d70576209ae01f7ae56a1afccc1210d120b0ecde

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to