From 68f72f3f6c20a3954c5fef74663af93584d10515 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 Jan 2021 19:01:37 +0000 Subject: [PATCH] bug fix. in a 32-bit system, sizeof(mem_block) is only 8, _upb_arena_alignup(sizeof(mem_block)) is 16 --- ruby/ext/google/protobuf_c/upb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/ext/google/protobuf_c/upb.c b/ruby/ext/google/protobuf_c/upb.c index 61e86fcf104a..fb5009cb2cc6 100644 --- a/ruby/ext/google/protobuf_c/upb.c +++ b/ruby/ext/google/protobuf_c/upb.c @@ -2357,7 +2357,7 @@ static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size, } static mem_block *upb_arena_allocblock(upb_arena *a, size_t size) { - size_t block_size = UPB_MAX(size, a->next_block_size) + sizeof(mem_block); + size_t block_size = UPB_MAX(size, a->next_block_size) + _upb_arena_alignup(sizeof(mem_block)); mem_block *block = upb_malloc(a->block_alloc, block_size); if (!block) {