From 13f4c147ab03145f1a955a0444fed26f0609bc80 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 6 Oct 2016 01:30:29 +0000 Subject: thread.c: check coverage values * thread.c (update_coverage): check coverage values, and ignore non-fixnum values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index c0bdaf546e..48c1896910 100644 --- a/thread.c +++ b/thread.c @@ -4940,10 +4940,13 @@ update_coverage(rb_event_flag_t event, VALUE proc, VALUE self, ID id, VALUE klas if (RB_TYPE_P(coverage, T_ARRAY) && !RBASIC_CLASS(coverage)) { long line = rb_sourceline() - 1; long count; + VALUE num; if (line >= RARRAY_LEN(coverage)) { /* no longer tracked */ return; } - count = FIX2LONG(RARRAY_AREF(coverage, line)) + 1; + num = RARRAY_AREF(coverage, line); + if (!FIXNUM_P(num)) return; + count = FIX2LONG(num) + 1; if (POSFIXABLE(count)) { RARRAY_ASET(coverage, line, LONG2FIX(count)); } -- cgit v1.2.3