Skip to content

Protobuf messages larger than 8 KiB are truncated #131

Open
@icdevin

Description

@icdevin

Describe the bug
Given a Protobuf-encoded message with more than 8,190 bytes of data, only 8,190 bytes of data are returned and the rest of the data is truncated.

To Reproduce
Steps to reproduce the behavior:
Construct a ProtoRawDecoder (or EasyProtoRawDecoder) and decode a message with a size larger than 8 KiB. No matter what the size of the initial data is, the bytes returned from the decode call will always be 8,190 bytes (8 KiB minus two varints read from the BufReader). Attempting to deserialize the message using the returned bytes will fail.

Expected behavior
All of the message bytes should be returned.

Additional context
This is due to BufReader::new having a default capacity of 8 KiB as noted in the docs: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions