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

Bryan Duxbury commented on THRIFT-547:
--------------------------------------

I see what you are saying. I'm thinking it's just not really useful in this 
circumstance though. All Thrift transports are tailor-made for serialization 
and deserialization, and Thrift structs don't just pull in a big blob of data 
from a memory transport - they get exactly the number of bytes they expect to 
be there. The first time there is an underrun, it's fatal. If we raised only 
once there was finally exactly zero bytes available, it wouldn't change 
anything. The error would just come on the second iteration of read_all instead 
of the first.

> Thrift deserializer hangs when deserializing empty string
> ---------------------------------------------------------
>
>                 Key: THRIFT-547
>                 URL: https://issues.apache.org/jira/browse/THRIFT-547
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1
>         Environment: ruby 1.8.6
>            Reporter: Dayo Esho
>            Assignee: Bryan Duxbury
>            Priority: Minor
>         Attachments: thrift-547.patch
>
>
> Expect this to throw an error on empty strings and any other strings that 
> cannot be deserialized. Here is some code to reproduce:
> require 'thrift'
> class MyClass
>   include ::Thrift::Struct
>   FIELDS = {}
>   def struct_fields; FIELDS; end
>   def validate; end
> end
> deserializer = Thrift::Deserializer.new(Thrift::CompactProtocolFactory.new)
> deserializer.deserialize(MyClass.new, '') ###### hangs 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to