You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2016/09/28 20:44:20 UTC

[jira] [Commented] (THRIFT-3935) Incorrect skipping of map

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

Jens Geyer commented on THRIFT-3935:
------------------------------------

Good catch, but two things:

 * This seems to fix only half of the issue. {{T_SET}} should be added to that function as well, it is entirely missing.
 * Please proivide a *patch file*, this makes life easier (or Github pull requests). Attachments can be added via *More => Attach Files* above



> Incorrect skipping of map
> -------------------------
>
>                 Key: THRIFT-3935
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3935
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Library
>    Affects Versions: 1.0
>         Environment: Ubuntu
>            Reporter: Matej Kupljen
>
> If a new map<> is added to the thrift structure and sending this new serialized thrift to the old version that didn't included yet this map definition it should skip it. It does so, but it uses read_set_begin/end instead of read_map_begin/end functions.
> Included patch fixes the problem.
> Thanks,
> Matej
> {code}
> diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
> index d6315d8..b274b00 100644
> --- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
> +++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
> @@ -489,14 +489,16 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
>        {
>          guint32 result = 0;
>          ThriftType elem_type;
> +        ThriftType key_type;
>          guint32 i, size;
> -        result += thrift_protocol_read_set_begin (protocol, &elem_type, &size,
> +        result += thrift_protocol_read_map_begin (protocol, &key_type, &elem_type, &size,
>                                                    error);
>          for (i = 0; i < size; i++)
>          {
> +          result += thrift_protocol_skip (protocol, key_type, error);
>            result += thrift_protocol_skip (protocol, elem_type, error);
>          }
> -        result += thrift_protocol_read_set_end (protocol, error);
> +        result += thrift_protocol_read_map_end (protocol, error);
>          return result;
>        }
>      case T_LIST:
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)