ruby-changes:60632
From: Nobuyoshi <ko1@a...>
Date: Fri, 3 Apr 2020 01:21:42 +0900 (JST)
Subject: [ruby-changes:60632] 2a4049b23c (master): Bail out before pushing unexpected object
https://git.ruby-lang.org/ruby.git/commit/?id=2a4049b23c From 2a4049b23c081eb5509490bac0414ac40e83c5c4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 3 Apr 2020 01:06:56 +0900 Subject: Bail out before pushing unexpected object diff --git a/gc.c b/gc.c index 1840edb..5d2801c 100644 --- a/gc.c +++ b/gc.c @@ -4629,6 +4629,18 @@ free_stack_chunks(mark_stack_t *stack) https://github.com/ruby/ruby/blob/trunk/gc.c#L4629 static void push_mark_stack(mark_stack_t *stack, VALUE data) { + VALUE obj = data; + switch (BUILTIN_TYPE(obj)) { + case T_NIL: + case T_FIXNUM: + rb_bug("push_mark_stack() called for broken object"); + break; + + case T_NODE: + UNEXPECTED_NODE(push_mark_stack); + break; + } + if (stack->index == stack->limit) { push_mark_stack_chunk(stack); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/