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

Rust's TBinaryInputProtocol fails when strict is false

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: 0.12.0
    • Component/s: Rust - Library
    • Labels:
      None
    • Environment:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: