diff options
| author | Christian Hoeppner <hoeppi@google.com> | 2026-03-24 19:33:15 +0000 |
|---|---|---|
| committer | Christian Höppner <hoeppi@google.com> | 2026-03-24 13:07:19 -0700 |
| commit | 3ebdf12d7c193e6d59a9908745a9664ce7944fd6 (patch) | |
| tree | a184e00b8d03847b0a429d41394995a74f77c11c /src/runtime | |
| parent | e20a1b603579fc36148530048c76de6938347019 (diff) | |
| download | go-3ebdf12d7c193e6d59a9908745a9664ce7944fd6.tar.xz | |
runtime: zero-extend Windows error code in syscall_syscalln
asmstdcall now returns the 32-bit Windows error code in the return
register. cgocall captures this as a signed int32. On 64-bit systems,
casting this directly to uintptr results in sign extension for error
codes with the high bit set (e.g., 0x80092004 becomes
0xffffffff80092004), breaking equality checks against zero-extended
constants.
This CL ensures the error code is zero-extended by casting to uint32
before converting to uintptr.
Fixes #78324
Change-Id: Ia75fe32965ccc7fb836f7caff8bbb8575af11e2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/758800
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/syscall_windows.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go index 9c60fdc8b9..842487601d 100644 --- a/src/runtime/syscall_windows.go +++ b/src/runtime/syscall_windows.go @@ -429,5 +429,5 @@ func syscall_syscalln(fn, n uintptr, args ...uintptr) (r1, r2, err uintptr) { // but it copies the return values into the new M's // so we can read them from there. c = &getg().m.winsyscall - return c.R1, c.R2, uintptr(errno) + return c.R1, c.R2, uintptr(uint32(errno)) } |
