Module: wine
Branch: master
Commit: ea9f47a767c20cdda3d912708b789314f09f8e28
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ea9f47a767c20cdda3d91270…
Author: Martin Storsjo <martin(a)martin.st>
Date: Fri Apr 10 00:42:21 2020 +0300
ntdll: Properly return errors when failing to unwind.
If libunwind is unavailable, make libunwind_virtual_unwind return an
error. Likewise if there was no PE exception info and we didn't try
unwinding using libunwind, we need to return an error when realizing
we were unable to unwind, instead of just warning and returning
success.
This fixes hangs/infinite loops on crashes when unwinding fails.
Signed-off-by: Martin Storsjo <martin(a)martin.st>
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/ntdll/signal_arm64.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index 5fffd45f7b..031c271846 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -597,8 +597,10 @@ static NTSTATUS libunwind_virtual_unwind( ULONG_PTR ip, ULONG_PTR *frame, CONTEX
context->u.s.X24, context->u.s.X25, context->u.s.X26, context->u.s.X27 );
TRACE(" x28=%016lx fp=%016lx lr=%016lx sp=%016lx\n",
context->u.s.X28, context->u.s.Fp, context->u.s.Lr, context->Sp );
-#endif
return STATUS_SUCCESS;
+#else
+ return STATUS_INVALID_DISPOSITION;
+#endif
}
@@ -645,7 +647,11 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
return STATUS_SUCCESS;
}
}
- else WARN( "exception data not found in %s\n", debugstr_w(module->BaseDllName.Buffer) );
+ else
+ {
+ WARN( "exception data not found in %s\n", debugstr_w(module->BaseDllName.Buffer) );
+ return STATUS_INVALID_DISPOSITION;
+ }
dispatch->EstablisherFrame = context->u.s.Fp;
dispatch->LanguageHandler = NULL;
Module: wine
Branch: master
Commit: f3b64f950f2cbed96ded71a6b0526c4621434d39
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f3b64f950f2cbed96ded71a6…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Sun Apr 12 14:24:57 2020 +0200
iphlpapi: Honor sa_len when reading AF_INET addresses.
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/iphlpapi/ipstats.c | 52 +++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 61f3a97ec4..11d52d4d65 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -1548,33 +1548,35 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
ADVANCE (addrPtr, sa);
- /* default routes are encoded by length-zero sockaddr */
- if (sa->sa_len == 0) {
- addr = 0;
- }else {
- /* Apple's netstat prints the netmask together with the destination
- * and only looks at the destination's address family. The netmask's
- * sa_family sometimes contains the non-existent value 0xff. */
- switch(i == RTA_NETMASK ? dst_family : sa->sa_family) {
- case AF_INET: {
- struct sockaddr_in *sin = (struct sockaddr_in *)sa;
- addr = sin->sin_addr.s_addr;
- break;
- }
+ /* Apple's netstat prints the netmask together with the destination
+ * and only looks at the destination's address family. The netmask's
+ * sa_family sometimes contains the non-existent value 0xff. */
+ switch(i == RTA_NETMASK ? dst_family : sa->sa_family) {
+ case AF_INET: {
+ /* Netmasks (and possibly other addresses) have only enough size
+ * to represent the non-zero bits, e.g. a netmask of 255.0.0.0 has
+ * 5 bytes (1 sa_len, 1 sa_family, 2 sa_port and 1 for the first
+ * byte of sin_addr). Due to the alignment constraint we can de
+ * facto read the full 4 bytes of sin_addr (except for the case of
+ * netmask 0). Don't assume though that the extra bytes are zeroed. */
+ struct sockaddr_in sin = {0};
+ memcpy(&sin, sa, sa->sa_len);
+ addr = sin.sin_addr.s_addr;
+ break;
+ }
#ifdef AF_LINK
- case AF_LINK:
- if(i == RTA_GATEWAY && row.u1.ForwardType == MIB_IPROUTE_TYPE_DIRECT) {
- /* For direct route we may simply use dest addr as next hop */
- C_ASSERT(RTA_DST < RTA_GATEWAY);
- addr = row.dwForwardDest;
- break;
- }
- /* fallthrough */
-#endif
- default:
- WARN ("Received unsupported sockaddr family 0x%x\n", sa->sa_family);
- addr = 0;
+ case AF_LINK:
+ if(i == RTA_GATEWAY && row.u1.ForwardType == MIB_IPROUTE_TYPE_DIRECT) {
+ /* For direct route we may simply use dest addr as next hop */
+ C_ASSERT(RTA_DST < RTA_GATEWAY);
+ addr = row.dwForwardDest;
+ break;
}
+ /* fallthrough */
+#endif
+ default:
+ WARN ("Received unsupported sockaddr family 0x%x\n", sa->sa_family);
+ addr = 0;
}
switch (i)
Module: wine
Branch: master
Commit: 7f4beb0883172a1629926e070fc6d5b6fab05922
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7f4beb0883172a1629926e07…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Sun Apr 12 14:24:55 2020 +0200
iphlpapi: Write an ERR if the sockaddr parsing went wrong.
It should not happen any more after the previous patch but it is subtle
enough that I think being verbose about it makes sense.
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/iphlpapi/ipstats.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 6986a4b315..9d6a84dd33 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -1539,6 +1539,12 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
continue;
sa = (struct sockaddr *)addrPtr;
+ if (addrPtr + sa->sa_len > next + rtm->rtm_msglen)
+ {
+ ERR ("struct sockaddr extends beyond the route message, %p > %p\n",
+ addrPtr + sa->sa_len, next + rtm->rtm_msglen );
+ }
+
ADVANCE (addrPtr, sa);
/* default routes are encoded by length-zero sockaddr */