thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allen George (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (THRIFT-4658) Rust's TBinaryInputProtocol fails when strict is false
Date Sun, 04 Nov 2018 19:38:00 GMT

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

Allen George edited comment on THRIFT-4658 at 11/4/18 7:37 PM:
---------------------------------------------------------------

Ah - dammit. Sorry about that :/ I'll get the fix into 0.12.0. Thank you for tracking this
down, BTW!


was (Author: allengeorge):
Ah - dammit. Sorry about that :/ I'll get the fix into 0.12.0

> 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)

Mime
View raw message