Remove erroneous function cast (#14673)

### Description
The custom thread entry point was declared `__stdcall` even though the
API dictated a different type. Casting caused improper cleanup of the
stack and crash manifested only in 32-bit Debug builds.

### Motivation and Context
This addresses https://github.com/microsoft/onnxruntime/issues/14613
This commit is contained in:
Dmitri Smirnov 2023-02-14 11:35:33 -08:00 committed by GitHub
parent 2a4c9a5cbf
commit 6eeeecf07f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,7 +95,7 @@ class WindowsThread : public EnvThread {
}
if (custom_create_thread_fn) {
custom_thread_handle = custom_create_thread_fn(custom_thread_creation_options, (OrtThreadWorkerFn)CustomThreadMain, local_param.get());
custom_thread_handle = custom_create_thread_fn(custom_thread_creation_options, CustomThreadMain, local_param.get());
if (!custom_thread_handle) {
ORT_THROW("custom_create_thread_fn returned invalid handle.");
}
@ -217,7 +217,7 @@ class WindowsThread : public EnvThread {
}
#pragma warning(pop)
static void __stdcall CustomThreadMain(void* param) {
static void CustomThreadMain(void* param) {
std::unique_ptr<Param> p(static_cast<Param*>(param));
ORT_TRY {
p->start_address(p->index, p->param);