Fixing UB by using memcpy instead of old style cast

[SVN r82218]
This commit is contained in:
Thomas Heller
2012-12-27 10:49:19 +00:00
parent 818b412673
commit 7cc6744ff6

View File

@@ -73,7 +73,9 @@ namespace boost
ptr += sizeof(std::size_t); ptr += sizeof(std::size_t);
while(length >= sizeof(std::size_t)) { while(length >= sizeof(std::size_t)) {
hash_float_combine(seed, *(std::size_t*) ptr); std::size_t buffer = 0;
std::memcpy(&buffer, ptr, sizeof(std::size_t));
hash_float_combine(seed, buffer);
length -= sizeof(std::size_t); length -= sizeof(std::size_t);
ptr += sizeof(std::size_t); ptr += sizeof(std::size_t);
} }