Skip to content

[pull] master from ruby:master - #1430

Merged
pull[bot] merged 2 commits into
turkdevops:masterfrom
ruby:master
Sep 20, 2026
Merged

pull[bot] merged 2 commits into
turkdevops:masterfrom
ruby:master

Conversation

@pull

@pull pull Bot commented Sep 20, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

nobu and others added 2 commits September 20, 2026 19:48
Avoid incorrect variadic argument forwarding in `RUBY_ASSERT_MESG_WHEN`
by the traditional MSVC preprocessor, which breaks `VM_ASSERT` when
`RUBY_DEBUG` is enabled.
If the array object passed into String#% is modified during conversion
(such as via to_s, to_i, to_f, etc.) then it can be a use-after-free if
the buffer of the array is freed.

This commit changes it to detect if the buffer has been changed and raises
an error when that happens.

The following script reproduces the crash:

    count = 1_000
    obj = Object.new
    ary = [obj, *Array.new(count - 1) { "x" }]
    obj.define_singleton_method(:to_s) do
      ary.replace([])
      "X"
    end
    str = "%s" * count
    puts (str % ary).length
@pull pull Bot locked and limited conversation to collaborators Sep 20, 2026
@pull pull Bot added the ⤵️ pull label Sep 20, 2026
@pull
pull Bot merged commit edce07a into turkdevops:master Sep 20, 2026
1 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants