[前][次][番号順一覧][スレッド一覧]

ruby-changes:44281

From: nobu <ko1@a...>
Date: Thu, 6 Oct 2016 10:30:35 +0900 (JST)
Subject: [ruby-changes:44281] nobu:r56354 (trunk): thread.c: check coverage values

nobu	2016-10-06 10:30:29 +0900 (Thu, 06 Oct 2016)

  New Revision: 56354

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56354

  Log:
    thread.c: check coverage values
    
    * thread.c (update_coverage): check coverage values, and ignore
      non-fixnum values.

  Modified files:
    trunk/ChangeLog
    trunk/thread.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56353)
+++ ChangeLog	(revision 56354)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Oct  6 10:30:27 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* thread.c (update_coverage): check coverage values, and ignore
+	  non-fixnum values.
+
 Thu Oct  6 09:19:21 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (fptr_finalize): use dedicated macro RB_INTEGER_TYPE_P.
Index: thread.c
===================================================================
--- thread.c	(revision 56353)
+++ thread.c	(revision 56354)
@@ -4940,10 +4940,13 @@ update_coverage(rb_event_flag_t event, V https://github.com/ruby/ruby/blob/trunk/thread.c#L4940
     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));
 	}

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]