Skip to content
Browse files

Fix SEGV. sometimes Kernel#eval pass invalid sourceline, so check whe…

…ther sourceline is valid.

This is related to commit e3918d6.
  • Loading branch information...
1 parent 154f4a6 commit 440f5dc2fc108ef1e57dcca3cd8087946ba0fc5d @katsuya katsuya committed with relevance-deploy
Showing with 9 additions and 2 deletions.
  1. +9 −2 ext/rcovrt/1.8/rcovrt.c
View
11 ext/rcovrt/1.8/rcovrt.c
@@ -51,8 +51,15 @@ static struct cov_array * coverage_increase_counter_uncached(char *sourcefile, u
}
if(mark_only) {
- if(!carray->ptr[sourceline])
- carray->ptr[sourceline] = 1;
+ if (carray && carray->len > sourceline) {
+ if(!carray->ptr[sourceline])
+ carray->ptr[sourceline] = 1;
+ } else {
+ #if COVERAGE_DEBUG_EVENTS
+ printf("DEBUG: %s carray->len:%d sourceline:%d\n",
+ sourcefile, carray->len, sourceline);
+ #endif
+ }
} else {
if (carray && carray->len > sourceline) {
carray->ptr[sourceline]++;

0 comments on commit 440f5dc

Please sign in to comment.
Something went wrong with that request. Please try again.