mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-08 05:00:16 +02:00
Windows: Validate any user handle permissions for syscall callbacks
In the terminate case, if we don't return early then we will delete the FEX thread object but the actual terminate call that follows will fail, leaving the thread in a bad state.
This commit is contained in:
1 parent
6f5d4fbf30
commit
b2b5ccf69c
4 files changed
+31
-1
No files matched your search
@@ -39,6 +39,7 @@ $end_info$
|
||||
#include "Common/Module.h"
|
||||
#include "Common/CRT/CRT.h"
|
||||
#include "Common/PortabilityInfo.h"
|
||||
#include "Common/Handle.h"
|
||||
#include "DummyHandlers.h"
|
||||
#include "BTInterface.h"
|
||||
#include "Windows/Common/SHMStats.h"
|
||||
@@ -959,6 +960,10 @@ NTSTATUS ThreadInit() {
|
||||
}
|
||||
|
||||
NTSTATUS ThreadTerm(HANDLE Thread, LONG ExitCode) {
|
||||
if (!FEX::Windows::ValidateHandleAccess(Thread, THREAD_TERMINATE)) {
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
THREAD_BASIC_INFORMATION Info;
|
||||
if (auto Err = NtQueryInformationThread(Thread, ThreadBasicInformation, &Info, sizeof(Info), nullptr); Err) {
|
||||
return Err;
|
||||
|
||||
Reference in new issue
Block a user