[ruby-core:102211] [Ruby master Bug#17574] Hash#inspect segfault
From:
takashikkbn@...
Date:
2021-01-23 06:44:29 UTC
List:
ruby-core #102211
Issue #17574 has been updated by k0kubun (Takashi Kokubun).
Status changed from Open to Feedback
I failed to reproduce this. Could you report your entire SEGV output to see a backtrace?
```
$ RUBYOPT=-v irb
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
irb(main):001:0> IRB::VERSION
=> "1.2.1"
irb(main):002:0> x = {1 => {2 => 5}, 3 => {4 => 6}}
irb(main):003:0> y = x[1]
irb(main):004:0> y[11] = 3
irb(main):005:0> x.transform_values!(&:clone)
=> {1=>{2=>5, 11=>3}, 3=>{4=>6}}
irb(main):006:0> y[11] = nil
irb(main):007:0> x
=> {1=>{2=>5, 11=>3}, 3=>{4=>6}}
```
----------------------------------------
Bug #17574: Hash#inspect segfault
https://bugs.ruby-lang.org/issues/17574#change-90058
* Author: 01wsmith (w smith)
* Status: Feedback
* Priority: Normal
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
While working in irb, I encountered an issue:
``` ruby
x = {1 => {2 => 5}, 3 => {4 => 6}}
y = x[1]
y[11] = 3
x.transform_values!(&:clone)
y[11] = nil
x
```
`x.inspect` causes irb to segfault.
I was not able to test this on ruby 3.0.0.
While experimenting with this I found that `x[1]` may change.
However, it seems to work fine in ruby itself.
irb -v: `irb 1.2.1 (2019-12-24)`
--
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>