-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Reading through the code, I found what looks like a race condition which can cause a "use-after-free".
When TUniqueInstance is destroyed, FThread is asked to terminate and FSocket is freed:
https://github.com/sysrpl/Codebot.Cross/blob/master/source/codebot/codebot.unique.pas#L77-L79
But the FThread can still be running and attempt to access FSocket after it is freed.
https://github.com/sysrpl/Codebot.Cross/blob/master/source/codebot/codebot.unique.pas#L99
(Imagine the thread checks Terminated and a context switch happens right after that. The main thread then calls TUniqueInstance.Destroy and FSocket is freed. When the thread continues to execute it calls FSocket.Accept(Client), but FSocket has already been freed.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels