diff options
| author | qmuntal <quimmuntal@gmail.com> | 2025-04-04 12:16:09 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-04-04 10:40:19 -0700 |
| commit | 6839e71d82e0f2c93e043820db6c0238a65ae0fa (patch) | |
| tree | cf2993697ec99ccab34f242842ebaea36af0908e /src/runtime | |
| parent | 7a427143b6ff296125359084a8959bf0c9d23e78 (diff) | |
| download | go-6839e71d82e0f2c93e043820db6c0238a65ae0fa.tar.xz | |
internal/syscall/windows: use unsafe.Pointer instead of uintptr
Some functions accept a uintptr when they should accept an
unsafe.Pointer, else the compiler won't know that the pointer should
be kept alive across the call, potentially causing undefined behavior.
Fixes #73156 (potentially)
Change-Id: I29c847eb8ffbb785fabf217e9f3718d10cfb5047
Reviewed-on: https://go-review.googlesource.com/c/go/+/662855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/runtime-seh_windows_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/runtime-seh_windows_test.go b/src/runtime/runtime-seh_windows_test.go index 42509532be..ca92d7f178 100644 --- a/src/runtime/runtime-seh_windows_test.go +++ b/src/runtime/runtime-seh_windows_test.go @@ -53,12 +53,12 @@ func TestSehLookupFunctionEntry(t *testing.T) { var base uintptr fn := windows.RtlLookupFunctionEntry(tt.pc, &base, nil) if !tt.hasframe { - if fn != 0 { + if fn != nil { t.Errorf("%s: unexpected frame", tt.name) } continue } - if fn == 0 { + if fn == nil { t.Errorf("%s: missing frame", tt.name) } } @@ -75,12 +75,12 @@ func sehCallers() []uintptr { var n int for i := 0; i < len(pcs); i++ { fn := windows.RtlLookupFunctionEntry(ctx.GetPC(), &base, nil) - if fn == 0 { + if fn == nil { break } pcs[i] = ctx.GetPC() n++ - windows.RtlVirtualUnwind(0, base, ctx.GetPC(), fn, uintptr(unsafe.Pointer(ctx)), nil, &frame, nil) + windows.RtlVirtualUnwind(0, base, ctx.GetPC(), fn, unsafe.Pointer(ctx), nil, &frame, nil) } return pcs[:n] } |
