Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4658

Rust's TBinaryInputProtocol fails when strict is false

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • Rust - Library
    • None

    Description

      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];
       

       

      Attachments

        Issue Links

          Activity

            People

              allengeorge Allen George
              jeikabu J W
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: