Issue #16019 has been reported by wanabe (_ wanabe).

----------------------------------------
Bug #16019: please backport df317151a5b4e0c5a30fcc321a9dc6abad63f7ed
https://bugs.ruby-lang.org/issues/16019

* Author: wanabe (_ wanabe)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`TracePoint#enable` can cause SEGV without df317151a5b4e0c5a30fcc321a9dc6abad63f7ed on ruby_2_6.

```
$ ((cd ../../; git checkout .); make install-nodoc -j4) >/dev/null 2>&1
$ ruby -v -e 'def foo; TracePoint.new(:b_return, &:disable).enable(target: method(:bar)); end;def bar; 100.times{ foo; foo }; end; bar'
ruby 2.6.3p65 (2019-06-22 revision 67712) [x86_64-linux]
double free or corruption (fasttop)
Aborted (core dumped)
$
```

But it can't with df317151a5b4e0c5a30fcc321a9dc6abad63f7ed.

```
$ ((cd ../../; git checkout .; git show df317151a5b4e0c5a30fcc321a9dc6abad63f7ed vm_trace.c|patch -p1); make install-nodoc -j4) >/dev/null 2>&1
$ ruby -v -e 'def foo; TracePoint.new(:b_return, &:disable).enable(target: method(:bar)); end;def bar; 100.times{ foo; foo }; end; bar'
ruby 2.6.3p65 (2019-06-22 revision 67712) [x86_64-linux]
$
```

I think ruby_2_5 doesn't need the commit because `TracePoint#enable` accepts "target:" since 2.6.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>