summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2024-11-04 18:05:59 -0800
committerJohn Hawthorn <[email protected]>2024-11-11 23:33:21 -0800
commit8409edc4971f34cf0d77c375909c5b8f7b1e058a ()
tree7f3e5dd2cf5d8b7d607526e8764ac51e197a195f /test/ruby/test_regexp.rb
parenta6fdd8883cab6b31357552db8a64cfb335678172 (diff)
Fix regex timeout double-free after stack_double
As of 10574857ce167869524b97ee862b610928f6272f, it's possible to crash on a double free due to `stk_alloc` AKA `msa->stack_p` being freed twice, once at the end of match_at and a second time in `FREE_MATCH_ARG` in the parent caller. Fixes [Bug #20886]
Notes: Merged: https://.com/ruby/ruby/pull/12030
-rw-r--r--test/ruby/test_regexp.rb7
1 files changed, 7 insertions, 0 deletions
@@ -1845,6 +1845,13 @@ class TestRegexp < Test::Unit::TestCase
end
end
def per_instance_redos_test(global_timeout, per_instance_timeout, expected_timeout)
assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}")
global_timeout = #{ EnvUtil.apply_timeout_scale(global_timeout).inspect }