Skip to content

Commit

Permalink
windows: remove the 8192-codepoint arg limit in FuzzComposeCommandLine
Browse files Browse the repository at this point in the history
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
  • Loading branch information
Bryan C. Mills authored and gopherbot committed Sep 27, 2023
1 parent 807530f commit 3186bae
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions windows/syscall_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3186bae

Please sign in to comment.