aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-02-25 02:58:04 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-02-25 09:46:02 +0000
commit37ca84a9cd6a8a76dfe91263a17d2b92b17a24b3 (patch)
treedddc680ee71e249bec5f258be2830bdc810d2b32 /src/syscall
parent76c0003cd5645078e342c1d24c98b3ce5ae42eb4 (diff)
downloadgo-37ca84a9cd6a8a76dfe91263a17d2b92b17a24b3.tar.gz
go-37ca84a9cd6a8a76dfe91263a17d2b92b17a24b3.zip
syscall: return error if GetQueuedCompletionStatus truncates key
This function has the wrong signature, so return an error when that actually might lead to unexpected results. Users should switch to x/sys/windows for the real version of this function. Updates #44538. Change-Id: I4d1f3d1e380815733ecfea683f939b1d25dcc32a Reviewed-on: https://go-review.googlesource.com/c/go/+/296154 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/syscall_windows.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index 5310f2da80..ee5311b176 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -1229,6 +1229,9 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla
err := getQueuedCompletionStatus(cphandle, qty, pukey, overlapped, timeout)
if key != nil {
*key = uint32(ukey)
+ if uintptr(*key) != ukey && err == nil {
+ err = errorspkg.New("GetQueuedCompletionStatus returned key overflow")
+ }
}
return err
}