From: Jason A. Donenfeld Date: Thu, 25 Feb 2021 01:58:04 +0000 (+0100) Subject: syscall: return error if GetQueuedCompletionStatus truncates key X-Git-Tag: go1.17beta1~1374 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=37ca84a9cd;p=gostls13.git 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 Run-TryBot: Jason A. Donenfeld TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills Reviewed-by: Ian Lance Taylor --- 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 }