mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
win32: fix massive memory corruption (take 2)
As pointed out by uau on IRC, the pointer to info is still used outside of the lock. An extremely small race condition window, but still a race condition.
This commit is contained in:
@@ -206,11 +206,12 @@ int pthread_detach(pthread_t thread)
|
||||
static DWORD WINAPI run_thread(LPVOID lpParameter)
|
||||
{
|
||||
pthread_mutex_lock(&pthread_table_lock);
|
||||
struct m_thread_info *info = find_thread_info(pthread_self());
|
||||
assert(info);
|
||||
struct m_thread_info *pinfo = find_thread_info(pthread_self());
|
||||
assert(pinfo);
|
||||
struct m_thread_info info = *pinfo;
|
||||
pthread_mutex_unlock(&pthread_table_lock);
|
||||
|
||||
pthread_exit(info->user_fn(info->user_arg));
|
||||
pthread_exit(info.user_fn(info.user_arg));
|
||||
abort(); // not reached
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user