Fix undefined behavior: load of misaligned address in atomparsing.h (#1037)

This commit is contained in:
Vitaly Baranov 2020-07-13 15:46:52 +03:00 committed by GitHub
parent 77e1e3cc18
commit a2f0933d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
namespace stage2 {
namespace atomparsing {
really_inline uint32_t string_to_uint32(const char* str) { return *reinterpret_cast<const uint32_t *>(str); }
really_inline uint32_t string_to_uint32(const char* str) { uint32_t val; std::memcpy(&val, str, sizeof(uint32_t)); return val; }
WARN_UNUSED
really_inline uint32_t str4ncmp(const uint8_t *src, const char* atom) {