Fix unaligned access in LoadStringFromGzip.
The code in LoadStringFromGzip was attempting to perform an unaligned access using memcpy, but it cast the source to a pointer with alignment requirements larger than 1, which, under optimizations, reintroduced the original issue.pull/339/head
parent
efc3da4579
commit
02ec64ee66
|
@ -45,7 +45,7 @@ std::string LoadStringFromGzip(const std::string &name) {
|
|||
|
||||
// *(uint32_t *) may perform an unaligned access, so do a memcpy.
|
||||
uint32_t inflatedSize;
|
||||
memcpy(&inflatedSize, (uint32_t *)((uintptr_t)data + deflatedSize - 4), sizeof(uint32_t));
|
||||
memcpy(&inflatedSize, (uint8_t *)((uintptr_t)data + deflatedSize - 4), sizeof(uint32_t));
|
||||
result.resize(inflatedSize);
|
||||
|
||||
stream.next_in = (Bytef *)data;
|
||||
|
|
Loading…
Reference in New Issue