summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--thread.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 54c3011ce0..c0ed20adf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct 6 10:30:27 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (update_coverage): check coverage values, and ignore
+ non-fixnum values.
+
Thu Oct 6 09:19:21 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (fptr_finalize): use dedicated macro RB_INTEGER_TYPE_P.
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));
}