diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2020-09-25 14:55:12 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2020-09-28 08:20:23 -0700 |
commit | b328b830264408b467a5c904a474e7112c5d678c (patch) | |
tree | bba2d0593b526839ad091e8e13ef8dc6367902c1 /ext | |
parent | 18b3f0f54c66632b1039a27634a8a449a7812e34 (diff) | |
download | ruby-b328b830264408b467a5c904a474e7112c5d678c.tar.gz |
make ext/coverage ASAN friendly
Diffstat (limited to 'ext')
-rw-r--r-- | ext/coverage/coverage.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c index 5b29ea2aea..be61595163 100644 --- a/ext/coverage/coverage.c +++ b/ext/coverage/coverage.c @@ -11,6 +11,7 @@ #include "gc.h" #include "internal/hash.h" #include "internal/thread.h" +#include "internal/sanitizers.h" #include "ruby.h" #include "vm_core.h" @@ -150,6 +151,9 @@ method_coverage_i(void *vstart, void *vend, size_t stride, void *data) VALUE ncoverages = *(VALUE*)data, v; for (v = (VALUE)vstart; v != (VALUE)vend; v += stride) { + void *poisoned = asan_poisoned_object_p(v); + asan_unpoison_object(v, false); + if (RB_TYPE_P(v, T_IMEMO) && imemo_type(v) == imemo_ment) { const rb_method_entry_t *me = (rb_method_entry_t *) v; VALUE path, first_lineno, first_column, last_lineno, last_column; @@ -189,6 +193,10 @@ method_coverage_i(void *vstart, void *vend, size_t stride, void *data) rb_hash_aset(methods, key, rcount); } } + + if (poisoned) { + asan_poison_object(v); + } } return 0; } |