Skip to content

Commit

Permalink
runtime: fix invalid pointer in windows/arm64 badsignal2
Browse files Browse the repository at this point in the history
Initializes the R3 register with an available address in the stack. The addressed location is used to receive the number of bytes written by WriteFile.

Fixes #56080

Change-Id: I0368eb7a31d2d6a098fa9c26e074eb1114a92704
GitHub-Last-Rev: 23dbdb5
GitHub-Pull-Request: #56153
Reviewed-on: https://go-review.googlesource.com/c/go/+/442216
Reviewed-by: Cherry Mui <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Cherry Mui <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
  • Loading branch information
billziss-gh authored and dr2chase committed Oct 12, 2022
1 parent 5bef938 commit 4a4de14
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/sys_windows_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ TEXT runtime·badsignal2(SB),NOSPLIT,$16-0
MOVD $runtime·badsignalmsg(SB), R1 // lpBuffer
MOVD $runtime·badsignallen(SB), R2 // lpNumberOfBytesToWrite
MOVD (R2), R2
MOVD R13, R3 // lpNumberOfBytesWritten
// point R3 to stack local that will receive number of bytes written
ADD $16, RSP, R3 // lpNumberOfBytesWritten
MOVD $0, R4 // lpOverlapped
MOVD runtime·_WriteFile(SB), R12
SUB $16, RSP // skip over saved frame pointer below RSP
Expand Down

0 comments on commit 4a4de14

Please sign in to comment.