MemTools: Always provide a valid pointer in send_msg for mach_msg_overwrite
This cannot be nullptr in macOS Ventura and iOS 16.
This commit is contained in:
parent
05160d8d2e
commit
3e5f1a4f99
|
@ -157,7 +157,6 @@ static void ExceptionThread(mach_port_t port)
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
memset(&msg_in, 0xee, sizeof(msg_in));
|
memset(&msg_in, 0xee, sizeof(msg_in));
|
||||||
memset(&msg_out, 0xee, sizeof(msg_out));
|
memset(&msg_out, 0xee, sizeof(msg_out));
|
||||||
mach_msg_header_t* send_msg = nullptr;
|
|
||||||
mach_msg_size_t send_size = 0;
|
mach_msg_size_t send_size = 0;
|
||||||
mach_msg_option_t option = MACH_RCV_MSG;
|
mach_msg_option_t option = MACH_RCV_MSG;
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -167,7 +166,7 @@ static void ExceptionThread(mach_port_t port)
|
||||||
// thread_set_exception_ports, or MACH_NOTIFY_NO_SENDERS due to
|
// thread_set_exception_ports, or MACH_NOTIFY_NO_SENDERS due to
|
||||||
// mach_port_request_notification.
|
// mach_port_request_notification.
|
||||||
CheckKR("mach_msg_overwrite",
|
CheckKR("mach_msg_overwrite",
|
||||||
mach_msg_overwrite(send_msg, option, send_size, sizeof(msg_in), port,
|
mach_msg_overwrite(&msg_out.Head, option, send_size, sizeof(msg_in), port,
|
||||||
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, &msg_in.Head, 0));
|
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, &msg_in.Head, 0));
|
||||||
|
|
||||||
if (msg_in.Head.msgh_id == MACH_NOTIFY_NO_SENDERS)
|
if (msg_in.Head.msgh_id == MACH_NOTIFY_NO_SENDERS)
|
||||||
|
@ -216,7 +215,6 @@ static void ExceptionThread(mach_port_t port)
|
||||||
msg_out.Head.msgh_size =
|
msg_out.Head.msgh_size =
|
||||||
offsetof(__typeof__(msg_out), new_state) + msg_out.new_stateCnt * sizeof(natural_t);
|
offsetof(__typeof__(msg_out), new_state) + msg_out.new_stateCnt * sizeof(natural_t);
|
||||||
|
|
||||||
send_msg = &msg_out.Head;
|
|
||||||
send_size = msg_out.Head.msgh_size;
|
send_size = msg_out.Head.msgh_size;
|
||||||
option |= MACH_SEND_MSG;
|
option |= MACH_SEND_MSG;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue