Subject: Re: [boost] [thread] thread_specific_ptr, dangerous conflation of identity and address
Date: 2010-02-15 17:54:27
Zitat von Edd Dawson <lists_at_[hidden]>:
> The bigger problem though, is that it might not be *their* old data.
> It can just as easily be someone else's old data due to coincidental
> alignment of different thread_specific_ptrs on the stack at entirely
> unrelated points in the program, or even in different libraries that
> each happen to use boost::thread_specific_ptr!
> It's easy to see the problem here as the calls are very close to one
> another. In general, however, this strikes me as being really rather
> dangerous behaviour.
> Would it be fair to call it a bug?
I have reported this bug here, including a simpler test case:
and posted a (more efficient) implementation of thread_specific_ptr
which doesn't have this bug here:
no reaction from the Boost.Thread maintainer so far.
(it's a prototype: it only supports GCC so far, and IIRC I have fixed
1 or 2 bugs locally only, without uploading it. so be careful using it.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk