summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2026-05-12 08:49:34 +0200
committergit <svn-admin@ruby-lang.org>2026-05-12 07:07:28 +0000
commit95c041bd3bdf0af0be00ed8546947dc73dc92897 (patch)
tree45cd89322c8d84124b9c6085be50bb1306b8e733 /test
parentfb369617736b868e6896426c1135fbe23f34cecd (diff)
[ruby/json] generator.c: Handle stupidly large depth
https://github.com/ruby/json/commit/1d32bd4596
Diffstat (limited to 'test')
-rwxr-xr-xtest/json/json_generator_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb
index 1cfd19da12..87d9cd7f7d 100755
--- a/test/json/json_generator_test.rb
+++ b/test/json/json_generator_test.rb
@@ -1081,4 +1081,15 @@ class JSONGeneratorTest < Test::Unit::TestCase
end
end
+ def test_large_depth_raises
+ assert_raise(RangeError, ArgumentError) do
+ JSON.generate([[1]],
+ indent: " " * 5,
+ array_nl: "\n",
+ depth: 3_689_348_814_741_910_324,
+ max_nesting: 0
+ )
+ end
+ end
+
end