Skip to content

Commit fe362c1

Browse files
committed
Fix segfault when using result of rest assignment
Reported by https://hackerone.com/haquaman
1 parent 2cca9d3 commit fe362c1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Diff for: mrbgems/mruby-compiler/core/codegen.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,9 @@ gen_vmassignment(codegen_scope *s, node *tree, int rhs, int val)
10611061
n++;
10621062
}
10631063
}
1064-
push();
1064+
if (!val) {
1065+
push();
1066+
}
10651067
}
10661068
}
10671069

Diff for: test/t/codegen.rb

+9
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@ def args_to_ary(*args)
5454
B
5555
assert_equal "\n", a
5656
end
57+
58+
assert('splat in case splat') do
59+
a = *case
60+
when 0
61+
* = 1
62+
end
63+
64+
assert_equal [1], a
65+
end

0 commit comments

Comments
 (0)