mirror of
https://github.com/golang/go
synced 2024-11-18 13:44:48 -07:00
internal/zstd: allow stream consisting of skippable frames
For #62513
Change-Id: I2557aed5ae106ea4684bb599cce740e9da9df780
GitHub-Last-Rev: 2b7ddc6c09
GitHub-Pull-Request: golang/go#63251
Reviewed-on: https://go-review.googlesource.com/c/go/+/531295
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
6cf6067d4e
commit
d785af1adb
@ -169,7 +169,7 @@ retry:
|
||||
|
||||
// Read magic number. RFC 3.1.1.
|
||||
if _, err := io.ReadFull(r.r, r.scratch[:4]); err != nil {
|
||||
// We require that the stream contain at least one frame.
|
||||
// We require that the stream contains at least one frame.
|
||||
if err == io.EOF && !r.readOneFrame {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -183,6 +183,7 @@ retry:
|
||||
if err := r.skipFrame(); err != nil {
|
||||
return err
|
||||
}
|
||||
r.readOneFrame = true
|
||||
goto retry
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,17 @@ var tests = []struct {
|
||||
"",
|
||||
"\x28\xb5\x2f\xfd\x00\x00\x15\x00\x00\x00\x00",
|
||||
},
|
||||
{
|
||||
"single skippable frame",
|
||||
"",
|
||||
"\x50\x2a\x4d\x18\x00\x00\x00\x00",
|
||||
},
|
||||
{
|
||||
"two skippable frames",
|
||||
"",
|
||||
"\x50\x2a\x4d\x18\x00\x00\x00\x00" +
|
||||
"\x50\x2a\x4d\x18\x00\x00\x00\x00",
|
||||
},
|
||||
}
|
||||
|
||||
func TestSamples(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user