File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,21 @@ def test_that_discount_does_not_blow_up_with_weird_formatting_case
2121 RDiscount . new ( text ) . to_html
2222 end
2323
24+ def test_that_oversized_input_raises_argument_error
25+ # mkd_string() takes an int length, so inputs > INT_MAX (2 147 483 647 bytes)
26+ # must be rejected before reaching C to avoid integer truncation / overflow.
27+ INT_MAX = 2_147_483_647
28+ begin
29+ oversized_text = 'a' * ( INT_MAX + 1 )
30+ rescue NoMemoryError
31+ skip "Insufficient memory to create oversized input for this test"
32+ end
33+
34+ assert_raise ( ArgumentError ) do
35+ RDiscount . new ( oversized_text ) . to_html
36+ end
37+ end
38+
2439 def test_that_smart_converts_double_quotes_to_curly_quotes
2540 rd = RDiscount . new ( %("Quoted text") , :smart )
2641 assert_equal %(<p>“Quoted text”</p>\n ) , rd . to_html
You can’t perform that action at this time.
0 commit comments