From 4e5dba158367f9b8b440e6c5051c95d9c22b76d7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 19 Jun 2023 08:49:48 +1000 Subject: [PATCH] Fix leveldb's alignment assumptions (we have 4 byte alignment) --- lib/leveldb/util/arena.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/leveldb/util/arena.cc b/lib/leveldb/util/arena.cc index 46e3b2eb..99224447 100644 --- a/lib/leveldb/util/arena.cc +++ b/lib/leveldb/util/arena.cc @@ -36,7 +36,7 @@ char* Arena::AllocateFallback(size_t bytes) { } char* Arena::AllocateAligned(size_t bytes) { - const int align = (sizeof(void*) > 8) ? sizeof(void*) : 8; + const int align = 4; static_assert((align & (align - 1)) == 0, "Pointer size should be a power of 2"); size_t current_mod = reinterpret_cast(alloc_ptr_) & (align - 1);