summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-04-11 10:55:46 +0200
committerJean Boussier <jean.boussier@gmail.com>2023-04-11 16:56:14 +0200
commit8c360ce713f57d4177de833297364f6f6d950420 (patch)
treedf98faaf72d599ca733fec57198c66047f62c45f /test
parent7b230bc8486e7d451113c3c0301adcecfc09b893 (diff)
downloadruby-8c360ce713f57d4177de833297364f6f6d950420.tar.gz
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.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb11
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]