]> Cypherpunks repositories - gostls13.git/commit
internal/zstd: fix seek offset bounds check in skipFrame
authoraimuz <mr.imuz@gmail.com>
Wed, 15 Nov 2023 15:21:23 +0000 (15:21 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 17 Nov 2023 16:39:21 +0000 (16:39 +0000)
commitae9fdbd8bca0ec01e522ddb5bc2baf7e27553f67
treed8e9aa395dcc60a6cd0cddedf1957c5884166f4e
parent2184a76fb8e1aeb0eb2d5401828548a25f90beae
internal/zstd: fix seek offset bounds check in skipFrame

This change enhances the zstd Reader's skipFrame function to validate
the new offset when skipping frames in a seekable stream, preventing
invalid offsets that could occur previously.

A set of "bad" test strings has been added to fuzz_test.go to extend
the robustness checks against potential decompression panics.

Additionally, a new test named TestReaderBad is introduced in
zstd_test.go to verify proper error handling with corrupted input
strings.

The BenchmarkLarge function has also been refactored for clarity,
removing unnecessary timer stops and resets.

Updates #63824

Change-Id: Iccd248756ad6348afa1395c7799350d07402868a
GitHub-Last-Rev: 63055b91e9413491fe8039ea42d55b823c89ec15
GitHub-Pull-Request: golang/go#64056
Reviewed-on: https://go-review.googlesource.com/c/go/+/541220
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Klaus Post <klauspost@gmail.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/zstd/fuzz_test.go
src/internal/zstd/zstd.go
src/internal/zstd/zstd_test.go