- changed status to resolved
Thread-safety hazard in dwsUtils.TidyStringsUnifier
Issue #233
resolved
Hello,
I have discovered a thread-safety problem (similar to issue #225) in the TidyStringsUnifier function. The current implementation allows to clean TStringUnifier instance still present in vUnifiedStrings[]. Scenario: Thread 1 calls TidyStringsUnifier, reads vUnifiedStrings[n] contents and gets nil, but before really invoking InterlockedCompareExchangePointer() thread 2 releases its instance causing InterlockedCompareExchangePointer to fail (comparing vUnifiedStrings[n] to nil) but returning the real instance.
The proposed fix is to check comparand value not to be nil before invoking InterlockedCompareExchangePointer, the patch is attached.
Best regards,
Joe
Comments (1)
-
repo owner - Log in to comment
Fixed Issue
#233Thread-safety hazard in dwsUtils.TidyStringsUnifier (Josef Kučera)→ <<cset 57175f1a60d5>>