Commit Graph

4 Commits

Author SHA1 Message Date
Damien Neil
4396dd4cd0 encoding/protodelim: drop TestUnmarshalFromBufioAllocations
This test is failing on at least one architecture.
It's probably too fragile to be worth figuring out;
drop the test entirely.

Fixes golang/protobuf#1554

Change-Id: I9106dbdd12af8719761fd7257b38d4f8584279a6
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/512677
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
2023-07-25 06:14:34 +00:00
Michael Stapelberg
59a8581684 encoding/protodelim: fix handling of io.EOF
Before this change, when encountering an io.EOF after reading at least
one byte, the zero value byte was — incorrectly — appended to sizeBuf,
and the io.EOF was ignored, resulting in a complete varint (0 has no
continuation bit), which in turn resulted in incorrect unmarshalling.

Change-Id: If06d45039d998eaddf91d0864814bb31d4cb7ae0
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/505555
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-06-26 07:38:07 +00:00
Vanja Pejovic
b8fc770601 encoding/protodelim: If UnmarshalFrom gets a bufio.Reader, try to reuse its buffer instead of creating a new one
When unmarshalling many messages, this reduces the amount of memory allocated and saves CPU time.

Change-Id: I440b8b223319ba2ed31ce559c125b1d640d5880c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/491596
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-05-08 20:37:08 +00:00
Sachin Padmanabhan
fb0abd9158 encoding: add protodelim package
Fixes golang/protobuf#1382

Change-Id: I30dc9bf9aa44e35cde8fb472c3b8b116d459714e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/419254
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2022-08-02 22:27:24 +00:00