If the block raises or breaks in String#each_grapheme_cluster, then the compiled regexp can leak memory because it is never freed. For example, the following code leaks memory: s = "abc".encode("UTF-16LE") 10.times do 10_...peterzhu2118 (Peter Zhu)
The string orig could have been modified by the time rb_str_tmp_frozen_release is called which would incorrectly modify orig. This can cause crashes. Each of the tests in this commit demonstrates a crash from users of rb_str_tmp_frozen_r...peterzhu2118 (Peter Zhu)
Array#sort! makes ary shared and tmp the shared root. The assumption is that tmp is never referred to by any object other than ary. However, if ary is sliced, than another array would also refer to tmp. This can cause an use-after-free w...peterzhu2118 (Peter Zhu)
Since ary takes over tmp's buffer in Array#sort!, it ary needs to be remembered otherwise if ary is old and tmp is young, then the objects in tmp can get garbage collected in the next GC cycle. The following script reproduces the issue:...peterzhu2118 (Peter Zhu)
If the receiving string is modified during the to_str call on the hash keys and values, then it could cache stale encoding and coderange, which could give negative character lengths. For example, the following code reproduces the issue:...peterzhu2118 (Peter Zhu)
With tailcall optimization enabled, ... argument forwarding incorrectly used the first argument as the parameter count. For example, the following code crashes: def bar(*a) = a def foo(...) bar(...) end RubyVM::In...peterzhu2118 (Peter Zhu)
Passing send symbol proc into a Thread will cause a buffer overflow where it will read past the VM stack. For example, the following script crashes in ASAN: p Thread.new(1, :to_s, &:send).value Crashes with: ERROR: AddressSan...peterzhu2118 (Peter Zhu)