aboutsummaryrefslogtreecommitdiff
path: root/src/io/fs/glob_test.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2022-07-13 15:35:44 +0000
committerMichael Anthony Knyszek <mknyszek@google.com>2022-07-13 15:35:44 +0000
commit7d5078e3bf2d865526e8ec2d211f61b2fac2936f (patch)
tree8f434be7d8e2ec1e3e5783f57deacdec41d454d9 /src/io/fs/glob_test.go
parent4658e6e324a85b0076f66acdab77799ffa9ac7bb (diff)
parent1ed3c127daceaffb9aadc806ba60f0b51b47421b (diff)
downloadgo-7d5078e3bf2d865526e8ec2d211f61b2fac2936f.tar.gz
go-7d5078e3bf2d865526e8ec2d211f61b2fac2936f.zip
[dev.boringcrypto.go1.17] all: merge go1.17.12 into dev.boringcrypto.go1.17
Change-Id: I652dbbb5721fa0c7be09be34b9ac1a987c331f6d
Diffstat (limited to 'src/io/fs/glob_test.go')
-rw-r--r--src/io/fs/glob_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/io/fs/glob_test.go b/src/io/fs/glob_test.go
index f19bebed77..d052eab371 100644
--- a/src/io/fs/glob_test.go
+++ b/src/io/fs/glob_test.go
@@ -8,6 +8,7 @@ import (
. "io/fs"
"os"
"path"
+ "strings"
"testing"
)
@@ -55,6 +56,15 @@ func TestGlobError(t *testing.T) {
}
}
+func TestCVE202230630(t *testing.T) {
+ // Prior to CVE-2022-30630, a stack exhaustion would occur given a large
+ // number of separators. There is now a limit of 10,000.
+ _, err := Glob(os.DirFS("."), "/*"+strings.Repeat("/", 10001))
+ if err != path.ErrBadPattern {
+ t.Fatalf("Glob returned err=%v, want %v", err, path.ErrBadPattern)
+ }
+}
+
// contains reports whether vector contains the string s.
func contains(vector []string, s string) bool {
for _, elem := range vector {