From c7d668801bd27f8245a15311da4e8e859ba28dec Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 25 Mar 2020 01:23:03 +0900 Subject: Fixed crash when argument array is modified --- test/ruby/test_dir.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby/test_dir.rb') diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index bab23302f7..13a0c31257 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -517,4 +517,16 @@ class TestDir < Test::Unit::TestCase assert_equal([*"a".."z"], list) end; end if defined?(Process::RLIMIT_NOFILE) + + def test_glob_array_with_destructive_element + args = Array.new(100, "") + pat = Struct.new(:ary).new(args) + args.push(pat, *Array.new(100) {"."*40}) + def pat.to_path + ary.clear + GC.start + "" + end + assert_empty(Dir.glob(args)) + end end -- cgit v1.2.3