Skip to content

Need to update ci variable after re-entry to VM - #6427

Merged
matz merged 1 commit into
mruby:masterfrom
dearblue:vm-recursive
Nov 19, 2024
Merged

matz merged 1 commit into
mruby:masterfrom
dearblue:vm-recursive

Conversation

@dearblue

Copy link
Copy Markdown
Contributor

Some functions called by mrb_vm_exec() involve re-entry into the mruby VM. If the ci variable is not updated after re-entry, use-after-free is caused.

This patch makes the following after-call fixes.

called might call methods
mrb_ary_splat() #to_a
hash_new_from_regs() #eql? #hash
mrb_hash_delete_key() #eql? #hash
mrb_hash_get() #eql? #hash #default
mrb_hash_key_p() #eql? #hash
mrb_hash_merge() #eql? #hash
mrb_hash_set() #eql? #hash
mrb_range_new() #<=>

Some functions called by `mrb_vm_exec()` involve re-entry into the mruby VM.
If the `ci` variable is not updated after re-entry, use-after-free is caused.

This patch makes the following after-call fixes.

| called                  | might call methods
| ----------------------- | ----------------
| `mrb_ary_splat()`       | `#to_a`
| `hash_new_from_regs()`  | `#eql?` `#hash`
| `mrb_hash_delete_key()` | `#eql?` `#hash`
| `mrb_hash_get()`        | `#eql?` `#hash` `#default`
| `mrb_hash_key_p()`      | `#eql?` `#hash`
| `mrb_hash_merge()`      | `#eql?` `#hash`
| `mrb_hash_set()`        | `#eql?` `#hash`
| `mrb_range_new()`       | `#<=>`
@dearblue
dearblue requested a review from matz as a code owner November 19, 2024 14:13
@github-actions github-actions Bot added the core label Nov 19, 2024
@matz
matz merged commit 9ea6bda into mruby:master Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants