id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 5187,uuid\seed_rng.hpp sha1_random_digest_state_ not random,qiaozhiqiang@…,Andy Tompkins,"boost_1_45_0\boost\uuid\seed_rng.hpp static unsigned int * sha1_random_digest_state_() { // intentionally left uninitialized // ERROR 1: not uninitialized! static value always zero all. // ERROR 2: always return the same pointer of static value // should delete 'static' static unsigned int state[ 5 ]; return state; } unsigned int * ps = sha1_random_digest_state_(); unsigned int state[ 5 ]; std::memcpy( state, ps, sizeof( state ) ); // harmless data race // ERROR 1: not uninitialized! static value always zero all. // so state is all zero sha.process_bytes( (unsigned char const*)state, sizeof( state ) ); // ERROR 2: always return the same pointer of static value // so ps is same ( ps === ps) sha.process_bytes( (unsigned char const*)&ps, sizeof( ps ) ); namespace boost { namespace uuids { namespace detail { // should this be part of Boost.Random? class seed_rng { static unsigned int * sha1_random_digest_state_() { // intentionally left uninitialized static unsigned int state[ 5 ]; return state; } void sha1_random_digest_() { boost::uuids::detail::sha1 sha; unsigned int * ps = sha1_random_digest_state_(); unsigned int state[ 5 ]; std::memcpy( state, ps, sizeof( state ) ); // harmless data race sha.process_bytes( (unsigned char const*)state, sizeof( state ) ); sha.process_bytes( (unsigned char const*)&ps, sizeof( ps ) );",Bugs,closed,To Be Determined,uuid,Boost 1.45.0,Problem,invalid,seed_rng,