summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-06 01:30:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-06 01:30:29 +0000
commitdd3b3d716e8da28f0717537a37be62207dfbf7d2 (patch)
treea6501e3c5be3e365f31ff337bd70e9fae4c421b2 /thread.c
parent20e7f819aaa23b481503455bff269c031b35d17f (diff)
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
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c5
1 files changed, 4 insertions, 1 deletions
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));
}