thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer (JIRA)" <>
Subject [jira] [Commented] (THRIFT-4024) C# deserialization takes unnecessary time on list with unknown type of elements
Date Tue, 10 Jan 2017 20:35:58 GMT


Jens Geyer commented on THRIFT-4024:

I already guessed it. Fuzzying could be the only case where that happens. Other than that,
there should be no undefined data types. The type system is well defined and very stable (so

> C# deserialization takes unnecessary time on list with unknown type of elements
> -------------------------------------------------------------------------------
>                 Key: THRIFT-4024
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Library
>    Affects Versions: 0.10.0
>            Reporter: Michael Antipin
>            Assignee: Jens Geyer
> I'm using TBinaryProtocol and a simple transport that reads from a given byte array.
> C# library contains the following code in TProtocolUtil.Skip(TProtocol prot, TType type):
> {code}
> case TType.List:
> 	TList list = prot.ReadListBegin();
> 	for (int i = 0; i < list.Count; i++) {
> 		Skip(prot, list.ElementType);
> 	}
> 	prot.ReadListEnd();
> 	break;
> {code}
> The type of elements is detected in ReadListBegin(), and, as Skip() does nothing for
unknown types, the position in the binary remains the same until the for loop completes. 
> So, when you try to deserialize invalid data, and a field type happens to be detected
as TType.List, you may end up waiting for a random period of time until deserialization is
completed (734707176 iterations of skipping in my case).
> I suggest throwing an exception immediately when list elements type is unknown. May be,
it would be good to have a setting like *FailOnUnknownType*, so that Skip() will throw instead
of ignoring.

This message was sent by Atlassian JIRA

View raw message