mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
d66e6e9e3f
We don't impose any alignment on hashable types, but this means the hashing function is doing invalid misaligned access when converting to a size_t. This aligns all of the primitive data types (crypto::hash, public keys, etc.) to the same alignment as size_t. That cascades into a few places in epee which only allow byte spanning types that have byte alignment when what it really requires is just that the type has no padding. In C++17 this is exactly the purpose of std::has_unique_object_representations, but that isn't available (or even implementable) in C++14 so add specializations for the type that need it to tell epee that we know those types are properly packed and that it can safely use them as bytes. Related to this, monero/epee also misuses `is_standard_layout` when the purpose is actually `is_trivially_copyable`, so fixed that too. (You need the latter but don't need the former for a type to be safely memcpy'able; the only purpose of `is_standard_layout` is when you need to be sure your structs are compatible with C structs which is irrelevant here). |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
database.cpp | ||
database.h | ||
error.cpp | ||
error.h | ||
key_stream.h | ||
table.cpp | ||
table.h | ||
transaction.h | ||
util.h | ||
value_stream.cpp | ||
value_stream.h |