[pull] master from ruby:master#1032
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )