summaryrefslogtreecommitdiff
path: root/test/fiber/test_process.rb
diff options
context:
space:
mode:
authorSamuel Williams <[email protected]>2023-08-29 20:04:14 +1200
committerGitHub <[email protected]>2023-08-29 20:04:14 +1200
commit901b6d9c5025a30b3d7a5ed0a2c00baf9cfb061d (patch)
treea7331e00fb79b82e8ecf59bad22c43409e21d704 /test/fiber/test_process.rb
parent141102b0b08c4feb682210033cac8d0f042c4beb (diff)
Validate the typed data before dereferencing the internal struct. (#8315)
Notes
Notes: Merged-By: ioquatix <[email protected]>
Diffstat (limited to 'test/fiber/test_process.rb')
-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