From 8c360ce713f57d4177de833297364f6f6d950420 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 11 Apr 2023 10:55:46 +0200 Subject: 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. --- test/ruby/test_hash.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') 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] -- cgit v1.2.3