Skip to content

[pull] master from ruby:master#1032

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

[pull] master from ruby:master#1032
pull[bot] merged 6 commits into
turkdevops:masterfrom
ruby:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 20, 2026

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 : )

XrXr and others added 6 commits May 19, 2026 16:26
Relevant for small negative immediates. Previously:

  # Insn: v16 SetLocal l1, EP@3, v10
  mov rsi, qword ptr [r13 + 0x20]
  mov rsi, qword ptr [rsi - 8]
  and rsi, 0xfffffffffffffffc
  # call rb_vm_env_write
  push rdi
  push rdi
  mov rdx, rdi
  mov rdi, rsi
  movabs rsi, 0xfffffffffffffffd
`io_buffer_not` accessed `buffer->base` directly without validating that the buffer was still live. A slice whose parent had been freed retained its stale base pointer, so calling `~` on it caused a UAF.

Use `io_buffer_get_bytes_for_reading`, which raises `IO::Buffer::InvalidatedError` before any memory access if the buffer has been invalidated.
A `Method#super_method` chain should return the methods that `super`
would call if the method was called normally. Previously, there were
multiple problems:

* There was an infinite `super_method` loop for refined methods.

* Lookup considered the refinements activated at the call site of
  `super_method`, and not all the call site of `super` inside the
  method.

This tries to recreate the logic that `super` uses inside
`super_method`. It avoids the loop. It also considers the refinements
activated for the method itself, not for the caller of `super_method`,
correctly handling refinements in outer scopes of the method. This
requires avoiding the use of rb_callable_method_entry_with_refinements,
which implicitly will consider refinements activated in the caller of
`super_method`.

The added tests attempt to ensure that the `super_method` lookup chain
matches the methods that `super` calls if you call the method.

This adds an `RICLASS_FOR_REFINEMENT_P` helper method, for logic that
is used a couple times in the new code and once in
`vm_search_normal_superclass`.
Bmethods need to use a different approach to find the cref to use
in order to determine the refinements in effect.
@pull pull Bot locked and limited conversation to collaborators May 20, 2026
@pull pull Bot added the ⤵️ pull label May 20, 2026
@pull pull Bot merged commit 8601f5a into turkdevops:master May 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.

5 participants