J W created THRIFT-4658:
---------------------------

             Summary: Rust's TBinaryInputProtocol fails when strict is false
                 Key: THRIFT-4658
                 URL: https://issues.apache.org/jira/browse/THRIFT-4658
             Project: Thrift
          Issue Type: Bug
          Components: Rust - Library
    Affects Versions: 0.11.0
         Environment:  

`rustup show` output:

Default host: x86_64-apple-darwin

installed toolchains

--------------------

stable-x86_64-apple-darwin

nightly-x86_64-apple-darwin

active toolchain

----------------

stable-x86_64-apple-darwin (default)

rustc 1.30.0 (da5f414c2 2018-10-24)
            Reporter: J W


When use `TBinaryInputProtocol::new(..., false)`, any trivial example will fail:

service TestService {
 bool Test()
}

 

Problem is here:

[https://github.com/apache/thrift/blob/master/lib/rs/src/protocol/binary.rs#L126]

with_capacity() allocates space, but len() of resulting Vec<> is 0.  
read_exact() reads 0 bytes and read_byte() below receives first byte of the 
string which may or may not convert to TMessageType.

Change it to:
let mut name_buf: Vec<u8> = vec![0; name_size];
 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to