summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-22 06:09:28 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-22 06:09:28 +0000
commitaef285f5dfb184e1a8a83eb5eb9146ba0f378e54 (patch)
tree6cb6cd9343089e55dbc4a2f608153e47b3e01660 /thread.c
parent658cd0871e0d05c40f2d4b4d923480db3479c2cc (diff)
merge revision(s) 54465: [Backport #12237]
* thread.c (update_coverage): Do not track coverage in loaded files after Coverage.result. Avoids out-of-bounds access. [Bug #12237] * ext/coverage/coverage.c (coverage_clear_result_i): document. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index b7056a764d..f9869d5d1e 100644
--- a/thread.c
+++ b/thread.c
@@ -5181,7 +5181,7 @@ update_coverage(rb_event_flag_t event, VALUE proc, VALUE self, ID id, VALUE klas
if (coverage && RBASIC(coverage)->klass == 0) {
long line = rb_sourceline() - 1;
long count;
- if (RARRAY_AREF(coverage, line) == Qnil) {
+ if (line >= RARRAY_LEN(coverage)) { /* no longer tracked */
return;
}
count = FIX2LONG(RARRAY_AREF(coverage, line)) + 1;