Project

General

Profile

Actions

Bug #20453

closed

Pointer being freed was not allocated in Regexp timeout

Added by dodecadaniel (Daniel Colson) 8 months ago. Updated 5 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:117697]

Description

https://bugs.ruby-lang.org/issues/20228 frees stk_base to avoid a memory leak, but stk_base is sometimes stack allocated (see xalloca). So the free only works if the regex stack grows enough that it needs to double (see xmalloc and xrealloc in stack_double.

Reproduction:

Regexp.timeout = 0.001
/^(a*)x$/ =~ "a" * 1000000 + "x"'

I'll open a PR shortly.

https://bugs.ruby-lang.org/issues/20228 was backported to 3.3.1, so this bug affects that version as well.

Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0