From 3186bae2c381d1867b412051c75b77b06b495d2a Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 26 Sep 2023 13:48:34 -0400 Subject: [PATCH] windows: remove the 8192-codepoint arg limit in FuzzComposeCommandLine It just occurred to me that the observed limit was almost certainly a side effect of the Go wrapper for CommandLineToArgv (golang/go#63236) rather than a behavior of the system call itself. Updates golang/go#63236. Updates golang/go#58817. Change-Id: Icc9db01f201f54a78044d1c48e0883e098cfb5e5 Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/sys/+/531176 LUCI-TryBot-Result: Go LUCI Auto-Submit: Bryan Mills Reviewed-by: Quim Muntal Reviewed-by: Than McIntosh --- windows/syscall_windows_test.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/windows/syscall_windows_test.go b/windows/syscall_windows_test.go index a8e7be43b..dcc706ded 100644 --- a/windows/syscall_windows_test.go +++ b/windows/syscall_windows_test.go @@ -589,6 +589,7 @@ func FuzzComposeCommandLine(f *testing.F) { f.Add(`C:\"Program Files"\Go\bin\go.exe` + "\x00env") f.Add(`C:\"Pro"gram Files\Go\bin\go.exe` + "\x00env") f.Add("\x00" + strings.Repeat("a", 8192)) + f.Add("\x00" + strings.Repeat("a", 8193)) f.Add(strings.Repeat("\x00"+strings.Repeat("a", 8192), 4)) f.Fuzz(func(t *testing.T, s string) { @@ -629,16 +630,6 @@ func FuzzComposeCommandLine(f *testing.F) { // have one or more runes converted to replacement characters. t.Skipf("skipping: input %d is not valid UTF-8", i) } - if len(arg) > 8192 { - // CommandLineToArgvW seems to truncate each argument after 8192 - // UTF-16 code units, although this behavior is not documented. Since - // it isn't documented, we shouldn't rely on it one way or the other, - // so skip the input to tell the fuzzer to try a different approach. - enc, _ := windows.UTF16FromString(arg) - if len(enc) > 8192 { - t.Skipf("skipping: input %d encodes to more than 8192 UTF-16 code units", i) - } - } } if testing.Verbose() { t.Logf("using input: %#q", args)