summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-02-06 09:14:49 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-02-06 09:14:49 +0900
commitf2b18a604c6e4db5875b689ba26b377ad720a3ab (patch)
tree47b98cf81bde3adfe03d148120ec737eba76b2fd /mrbgems/mruby-compiler/core/codegen.c
parent48e0bbbfeea8268b09ad0a6bbc840834cc443fe0 (diff)
downloadmruby-f2b18a604c6e4db5875b689ba26b377ad720a3ab.tar.gz
mruby-f2b18a604c6e4db5875b689ba26b377ad720a3ab.zip
Check maximum number of formal arguments.
http://hkdnet.hatenablog.com/entry/2017/02/06/080000 (Japanese)
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 1f7c069d4..778b6fe0f 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -666,6 +666,9 @@ lambda_body(codegen_scope *s, node *tree, int blk)
ka = kd = 0;
ba = tree->car->cdr->cdr->cdr->cdr ? 1 : 0;
+ if (ma > 0x1f || oa > 0x1f || pa > 0x1f || ka > 0x1f) {
+ codegen_error(s, "too many formal arguments");
+ }
a = ((mrb_aspec)(ma & 0x1f) << 18)
| ((mrb_aspec)(oa & 0x1f) << 13)
| ((ra & 1) << 12)