Hash: Merge UB fix to release.

[SVN r82256]
This commit is contained in:
Daniel James
2012-12-29 11:11:43 +00:00
parent cc091d5d98
commit 4aec4be0ed
2 changed files with 4 additions and 1 deletions

View File

@@ -150,5 +150,6 @@
* On platforms that are known to have standard floating point, don't use the
automatic detection of floating point functions - which can break if there
are ambiguous overloads.
* Fix undefined behaviour when using the binary float hash (Thomas Heller).
[endsect]

View File

@@ -73,7 +73,9 @@ namespace boost
ptr += 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);
ptr += sizeof(std::size_t);
}