From a20c2a08abf48099f38d16f103312aad12c6999b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 3 Dec 2021 15:04:14 +0900 Subject: variable.c: should not access `NULL[0]` to avoid asan warnings. --- src/variable.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/variable.c b/src/variable.c index bce6e0ef3..1130b7aaf 100644 --- a/src/variable.c +++ b/src/variable.c @@ -48,6 +48,7 @@ iv_rehash(mrb_state *mrb, iv_tbl *t) t->alloc = new_alloc; t->size = 0; t->ptr = (mrb_value*)mrb_calloc(mrb, sizeof(mrb_value)+sizeof(mrb_sym), new_alloc); + if (old_alloc == 0) return; mrb_sym *keys = (mrb_sym*)&old_ptr[old_alloc]; mrb_value *vals = old_ptr; -- cgit v1.2.3