[ https://issues.apache.org/jira/browse/THRIFT-4658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16674595#comment-16674595 ]
ASF GitHub Bot commented on THRIFT-4658: ---------------------------------------- allengeorge commented on issue #1620: THRIFT-4658: TBinaryInputProtocol fails when strict is false URL: https://github.com/apache/thrift/pull/1620#issuecomment-435734864 Note: * Added unit tests * Ran cross-tests in docker ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > 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 > Assignee: Allen George > Priority: Major > > 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)