diff options
| author | nagachika <nagachika@ruby-lang.org> | 2023-07-17 14:21:39 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2023-07-17 14:21:39 +0900 |
| commit | 8165db0f4666f90fe0df5cdd466f73c6de1f6cea (patch) | |
| tree | 14fc705c6af8d679b6d567f573e72eeecfef3239 /test/ruby | |
| parent | a7b0d3c9db9afeccf6e0962bb1cdcbea5bf04cae (diff) | |
merge revision(s) 8c360ce713f57d4177de833297364f6f6d950420: [Backport #19589]
hash.c: Fix hash_iter_lev_dec corrupting shape
[Bug #19589]
When decrementing `iter_lev` from `65` to `64` the flags would be
corrupted, causing the shape_id to be invalid.
---
hash.c | 12 +++++++++---
test/ruby/test_hash.rb | 11 +++++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_hash.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 83d16d462e..8b6065146c 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1556,6 +1556,17 @@ class TestHash < Test::Unit::TestCase end end + def hash_iter_recursion(h, level) + return if level == 0 + h.each_key {} + h.each_value { hash_iter_recursion(h, level - 1) } + end + + def test_iterlevel_in_ivar_bug19589 + h = { a: nil } + hash_iter_recursion(h, 200) + end + def test_threaded_iter_level bug9105 = '[ruby-dev:47807] [Bug #9105]' h = @cls[1=>2] |
