summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2023-09-24 14:16:10 +0900
committernagachika <nagachika@ruby-lang.org>2023-09-24 14:16:10 +0900
commit9cd28caa7cc3b0d987db7c1231fe101fb3b27399 (patch)
tree0aa1d9355eb8aad49c5987b9ac3a2cf67a4eac7a /test
parent217ef2bf89b3861e83c2e2a3a633c019f0731de6 (diff)
merge revision(s) 901b6d9c5025a30b3d7a5ed0a2c00baf9cfb061d: [Backport #19853]
Validate the typed data before dereferencing the internal struct. (#8315) --- process.c | 5 +++-- test/fiber/test_process.rb | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-)
Diffstat (limited to 'test')
-rw-r--r--test/fiber/test_process.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/fiber/test_process.rb b/test/fiber/test_process.rb
index a5990be204..cc1694576e 100644
--- a/test/fiber/test_process.rb
+++ b/test/fiber/test_process.rb
@@ -34,6 +34,27 @@ class TestFiberProcess < Test::Unit::TestCase
end.join
end
+ def test_system_faulty_process_wait
+ Thread.new do
+ scheduler = Scheduler.new
+
+ def scheduler.process_wait(pid, flags)
+ Fiber.blocking{Process.wait(pid, flags)}
+
+ # Don't return `Process::Status` instance.
+ return false
+ end
+
+ Fiber.set_scheduler scheduler
+
+ Fiber.schedule do
+ assert_raise TypeError do
+ system("true")
+ end
+ end
+ end.join
+ end
+
def test_fork
omit 'fork not supported' unless Process.respond_to?(:fork)
Thread.new do