diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-04-10 08:21:03 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-04-10 08:25:44 +0900 |
| commit | c063641ab0c32ab19715342a4856ed040a1fde14 (patch) | |
| tree | 4473a7a95eddc90137185b50fd0d8c5911d20347 /src | |
| parent | 47f181519f009e91aac06b0f8a6f529f6dfcf579 (diff) | |
| download | mruby-c063641ab0c32ab19715342a4856ed040a1fde14.tar.gz mruby-c063641ab0c32ab19715342a4856ed040a1fde14.zip | |
Clear local (but non-argument) variables in OP_ENTER.
Otherwise, the following script prints an uninitialized value.
def f(*a)
if false
b = 15
end
p b
end
f(1,2,3)
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1637,6 +1637,10 @@ RETRY_TRY_BLOCK: } pc += o + 1; } + /* clear local (but non-argument) variables */ + if (irep->nlocals-len-2 > 0) { + stack_clear(®s[len+2], irep->nlocals-len-2); + } JUMP; } |
