mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-03 07:37:34 -04:00
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 <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>
This commit is contained in:
committed by
Gopher Robot
parent
807530fc6d
commit
3186bae2c3
@@ -589,6 +589,7 @@ func FuzzComposeCommandLine(f *testing.F) {
|
|||||||
f.Add(`C:\"Program Files"\Go\bin\go.exe` + "\x00env")
|
f.Add(`C:\"Program Files"\Go\bin\go.exe` + "\x00env")
|
||||||
f.Add(`C:\"Pro"gram 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", 8192))
|
||||||
|
f.Add("\x00" + strings.Repeat("a", 8193))
|
||||||
f.Add(strings.Repeat("\x00"+strings.Repeat("a", 8192), 4))
|
f.Add(strings.Repeat("\x00"+strings.Repeat("a", 8192), 4))
|
||||||
|
|
||||||
f.Fuzz(func(t *testing.T, s string) {
|
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.
|
// have one or more runes converted to replacement characters.
|
||||||
t.Skipf("skipping: input %d is not valid UTF-8", i)
|
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() {
|
if testing.Verbose() {
|
||||||
t.Logf("using input: %#q", args)
|
t.Logf("using input: %#q", args)
|
||||||
|
|||||||
Reference in New Issue
Block a user