Skip to content

Using Thread in a global can cause crash on Windows #282

@cbigler

Description

@cbigler

Windows 7 32-bit
Poco 1.4.5

The implementation of Thread::uniqueId() (called in the Thread ctor initializer list) locks the global "uniqueIdMutex" FastMutex. If another program global uses Poco::Thread (or another Poco class that uses Thread, like DirectoryWatcher), there is a chance that an access violation will occur in MutexImpl::lockImpl, line 76 "EnterCriticalSection(&_cs)" since the CRITICAL_SECTION will not have been initialized yet.

Poco::MutexImpl::lockImpl() Line 76
Poco::FastMutex::lock() Line 260
Poco::ScopedLock<Poco::FastMutex>::ScopedLock<Poco::FastMutex>(Poco::FastMutex & mutex) Line 61
Poco::Thread::uniqueId() Line 162
Poco::Thread::Thread() Line 64

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions