summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-01-17 11:50:40 -0500
committerPeter Zhu <[email protected]>2024-01-17 15:51:44 -0500
commita6e924cf5f67368b49d5745f5cae22bc68ef21a1 (patch)
tree4685da26eb59a58caf7b264f8ac902e7e0a2a497 /test
parentb0a32b724971c5113c02946b1b959c1d73a9e256 (diff)
[PRISM] Fix crash in compile_prism
If the argument is not a file or a string, it assumes it's a string which will crash because RSTRING_PTR and RSTRING_LEN assumes it's a string.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_iseq.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index dd81610b53..35bf36e492 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -809,4 +809,10 @@ class TestISeq < Test::Unit::TestCase
end
end
end
+
+ def test_compile_prism_with_invalid_object_type
+ assert_raise(TypeError) do
+ RubyVM::InstructionSequence.compile_prism(Object.new)
+ end
+ end
end