aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-09-09 05:35:26 +0200
committerBjörn Gustavsson <[email protected]>2017-09-11 12:38:59 +0200
commit3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe (patch)
tree9a778d33aef49030fd502c66366c906a28a7f3f8
parente15db73b196b1a38f5ce18684739e2b5dd8bb9b2 (diff)
downloadotp-3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe.tar.gz
otp-3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe.tar.bz2
otp-3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe.zip
Check the right side of a transformation better
The right side of a transformation must be either a single call to a transformation function OR a list of instructions. Mixing them like this is not supported: some_instruction A B C => gen_something(A) | other B C Unfortunately, beam_makeops would silenty ignore anything after the function call, basically handling it in the same way as: some_instruction A B C => gen_something(A) Add a sanity check to reject such mixed right-hand sides.
-rwxr-xr-xerts/emulator/utils/beam_makeops7
1 files changed, 5 insertions, 2 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index 38754e67a1..e55d3eadb5 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -1720,8 +1720,11 @@ sub parse_transformation {
#
my @to;
- if ($to =~ /^(\w+)\((.*?)\)/) {
- my($name, $arglist) = ($1, $2);
+ if ($to =~ /^(\w+)\((.*?)\)(.*)/) {
+ my($name, $arglist, $garbage) = ($1, $2, $3);
+ if ($garbage =~ /\S/) {
+ error("garbage after call to '$name()'");
+ }
@to = (compile_transform_function($name, split(/\s*,\s*/, $arglist)));
} else {
@to = split(/\s*\|\s*/, $to);