diff options
Diffstat (limited to 'src/path/filepath/match_test.go')
-rw-r--r-- | src/path/filepath/match_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/path/filepath/match_test.go b/src/path/filepath/match_test.go index 375c41a7e9..d6282596fe 100644 --- a/src/path/filepath/match_test.go +++ b/src/path/filepath/match_test.go @@ -155,6 +155,16 @@ func TestGlob(t *testing.T) { } } +func TestCVE202230632(t *testing.T) { + // Prior to CVE-2022-30632, this would cause a stack exhaustion given a + // large number of separators (more than 4,000,000). There is now a limit + // of 10,000. + _, err := Glob("/*" + strings.Repeat("/", 10001)) + if err != ErrBadPattern { + t.Fatalf("Glob returned err=%v, want ErrBadPattern", err) + } +} + func TestGlobError(t *testing.T) { bad := []string{`[]`, `nonexist/[]`} for _, pattern := range bad { |