Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SEGV by stack extension in mrb_get_args()
mrb_get_args() keeps pointer of the current stack. But address of the current stack maybe changed by method call. 'i' format character calls #to_i when the argument isn't integer but has #to_i. Here is a code that may call #to_i in mrb_get_args(): case 'i': // ... default: *p = mrb_fixnum(mrb_Integer(mrb, ARGV[arg_i])); break; // ... Here is a code #to_i is called: class X def initialize(i) @i = i end def to_i @i end end [X.new(0), 0] # X#to_i is called So, mrb_get_args() shouldn't keep pointer and use it. mrb_get_args() should always refer mrb->ci->stack to use valid address of the current stack.
- Loading branch information
Showing 1 changed file with 45 additions and 35 deletions.
There are no files selected for viewing
This file contains 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