From 787487b16dce4fbb9059a70b13d31d8be679fe70 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 19 Feb 2021 15:36:41 +0900 Subject: Check `MRB_TT_*` before object allocation; ref #5352 --- src/gc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gc.c b/src/gc.c index 98a2237d5..07ca61e52 100644 --- a/src/gc.c +++ b/src/gc.c @@ -559,6 +559,9 @@ mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls) mrb_raisef(mrb, E_TYPE_ERROR, "allocation failure of %C", cls); } } + if (ttype <= MRB_TT_FREE) { + mrb_raisef(mrb, E_TYPE_ERROR, "allocation failure of %C (type %d)", cls, (int)ttype); + } #ifdef MRB_GC_STRESS mrb_full_gc(mrb); -- cgit v1.2.3