diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-02-14 00:15:58 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-02-14 00:15:58 +0900 |
| commit | 719f700adf7598d0ad910dcd3a94aad2ef354033 (patch) | |
| tree | 5fd9bbe444c517b4fca41ee26ecfcdeb9823492e /src | |
| parent | ecb6ac8b4aca56582ebed3e955178a0ad6c77d5d (diff) | |
| download | mruby-719f700adf7598d0ad910dcd3a94aad2ef354033.tar.gz mruby-719f700adf7598d0ad910dcd3a94aad2ef354033.zip | |
Extend mruby stack when keep is bigger than room; fix #3421
But #3421 still cause stack overflow error due to infinite recursion.
To prevent overflow, we need to add different stack depth check.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -169,6 +169,9 @@ stack_extend_alloc(mrb_state *mrb, int room, int keep) static inline void stack_extend(mrb_state *mrb, int room, int keep) { + if (room < keep) { + room = keep; + } if (mrb->c->stack + room >= mrb->c->stend) { stack_extend_alloc(mrb, room, keep); } |
