mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-10 10:09:56 +00:00
fix: windows crash for golang1.26 on WSARecvFrom syscall
This commit is contained in:
55
.github/patch/issue77975.patch
vendored
Normal file
55
.github/patch/issue77975.patch
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
Subject: [PATCH] move lpFromlen to heap for WSARecvFrom syscall
|
||||
---
|
||||
Index: src/internal/poll/fd_windows.go
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/internal/poll/fd_windows.go b/src/internal/poll/fd_windows.go
|
||||
--- a/src/internal/poll/fd_windows.go (revision 8149d992682ce76c6af804b507878e19fc966f7b)
|
||||
+++ b/src/internal/poll/fd_windows.go (revision 25efab96145f416bbae4024e9c110429770b22d1)
|
||||
@@ -76,6 +76,8 @@
|
||||
// fields used by runtime.netpoll
|
||||
runtimeCtx uintptr
|
||||
mode int32
|
||||
+
|
||||
+ rsan int32
|
||||
}
|
||||
|
||||
func (fd *FD) overlapped(o *operation) *syscall.Overlapped {
|
||||
@@ -740,9 +742,9 @@
|
||||
rsa := wsaRsaPool.Get().(*syscall.RawSockaddrAny)
|
||||
defer wsaRsaPool.Put(rsa)
|
||||
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
||||
- rsan := int32(unsafe.Sizeof(*rsa))
|
||||
+ o.rsan = int32(unsafe.Sizeof(*rsa))
|
||||
var flags uint32
|
||||
- err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &rsan, &o.o, nil)
|
||||
+ err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &o.rsan, &o.o, nil)
|
||||
return qty, err
|
||||
})
|
||||
err = fd.eofError(n, err)
|
||||
@@ -771,9 +773,9 @@
|
||||
rsa := wsaRsaPool.Get().(*syscall.RawSockaddrAny)
|
||||
defer wsaRsaPool.Put(rsa)
|
||||
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
||||
- rsan := int32(unsafe.Sizeof(*rsa))
|
||||
+ o.rsan = int32(unsafe.Sizeof(*rsa))
|
||||
var flags uint32
|
||||
- err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &rsan, &o.o, nil)
|
||||
+ err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &o.rsan, &o.o, nil)
|
||||
return qty, err
|
||||
})
|
||||
err = fd.eofError(n, err)
|
||||
@@ -802,9 +804,9 @@
|
||||
rsa := wsaRsaPool.Get().(*syscall.RawSockaddrAny)
|
||||
defer wsaRsaPool.Put(rsa)
|
||||
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
||||
- rsan := int32(unsafe.Sizeof(*rsa))
|
||||
+ o.rsan = int32(unsafe.Sizeof(*rsa))
|
||||
var flags uint32
|
||||
- err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &rsan, &o.o, nil)
|
||||
+ err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &o.rsan, &o.o, nil)
|
||||
return qty, err
|
||||
})
|
||||
err = fd.eofError(n, err)
|
||||
Reference in New Issue
Block a user