From 5e62c1a0d80bd31d5205107eb1f3961ba065691b Mon Sep 17 00:00:00 2001 From: hongzhidao Date: Fri, 13 Dec 2019 12:47:37 +0800 Subject: [PATCH] Fixed import segfault. This closes #274 issue on Github. --- src/njs_module.c | 1 + test/module/lib1.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/njs_module.c b/src/njs_module.c index 61a2bb65..b0aa0482 100644 --- a/src/njs_module.c +++ b/src/njs_module.c @@ -175,6 +175,7 @@ njs_parser_module(njs_vm_t *vm, njs_parser_t *parser) goto fail; } + module->function.args_offset = 1; module->function.u.lambda = parser->node->u.value.data.u.lambda; njs_mp_free(vm->mem_pool, text.start); diff --git a/test/module/lib1.js b/test/module/lib1.js index 5bfe2d0d..f2909605 100644 --- a/test/module/lib1.js +++ b/test/module/lib1.js @@ -1,3 +1,9 @@ +var foo = (function(){ + return (function f() {}) +}); + +foo()({1:[]}) + function hash() { var h = crypto.createHash('md5'); var v = h.update('AB').digest('hex'); -- 2.47.3