Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion `blk' failed in Escargot::FunctionExpressionNode::generateExpressionByteCode #29

Closed
renatahodovan opened this issue Dec 30, 2018 · 0 comments

Comments

@renatahodovan
Copy link
Member

Escargot version:
Checked revision: 8bcf72a
Build command: cmake -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=bin -GNinja && ninja
OS:
Ubuntu 18.04, x86_64
Test case:
for ( var id_0 = { toString : function ( ) {} } in Array.toString ) { } 
Backtrace:
escargot: escargot/src/parser/ast/FunctionExpressionNode.h:58: virtual void Escargot::FunctionExpressionNode::generateExpressionByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*, ByteCodeRegisterIndex): Assertion `blk' failed.
b
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff688d801 in __GI_abort () at abort.c:79
#2  0x00007ffff687d39a in __assert_fail_base (fmt=0x7ffff6a047d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55555581d77a "blk", 
    file=file@entry=0x55555581d9b8 "escargot/src/parser/ast/FunctionExpressionNode.h", line=line@entry=58, 
    function=function@entry=0x555555820320 <Escargot::FunctionExpressionNode::generateExpressionByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*, unsigned short)::__PRETTY_FUNCTION__> "virtual void Escargot::FunctionExpressionNode::generateExpressionByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*, ByteCodeRegisterIndex)") at assert.c:92
#3  0x00007ffff687d412 in __GI___assert_fail (assertion=0x55555581d77a "blk", file=0x55555581d9b8 "escargot/src/parser/ast/FunctionExpressionNode.h", line=58, 
    function=0x555555820320 <Escargot::FunctionExpressionNode::generateExpressionByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*, unsigned short)::__PRETTY_FUNCTION__> "virtual void Escargot::FunctionExpressionNode::generateExpressionByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*, ByteCodeRegisterIndex)") at assert.c:101
#4  0x000055555562fa6c in Escargot::FunctionExpressionNode::generateExpressionByteCode (this=0x7ffff482df70, codeBlock=0x7ffff7e68610, context=0x7fffffffd200, dstIndex=3)
    at escargot/src/parser/ast/FunctionExpressionNode.h:58
#5  0x00005555556317db in Escargot::ObjectExpressionNode::generateExpressionByteCode (this=0x7ffff482ff10, codeBlock=0x7ffff7e68610, context=0x7fffffffd200, dstRegister=2)
    at escargot/src/parser/ast/ObjectExpressionNode.h:70
#6  0x00005555556387ff in Escargot::VariableDeclarationNode::generateStoreByteCode (this=0x7ffff482fe40, codeBlock=0x7ffff7e68610, context=0x7fffffffd200, src=2, needToReferenceSelf=true)
    at escargot/src/parser/ast/VariableDeclarationNode.h:56
#7  0x000055555562ebd0 in Escargot::ForInStatementNode::generateStatementByteCode (this=0x7ffff4830f70, codeBlock=0x7ffff7e68610, context=0x7fffffffd7c0)
    at escargot/src/parser/ast/ForInStatementNode.h:89
#8  0x000055555561f06c in Escargot::StatementContainer::generateStatementByteCode (this=0x555555bac510, codeBlock=0x7ffff7e68610, context=0x7fffffffd7c0)
    at escargot/src/parser/ast/StatementNode.h:75
#9  0x0000555555631db9 in Escargot::ProgramNode::generateStatementByteCode (this=0x7ffff482ee30, codeBlock=0x7ffff7e68610, context=0x7fffffffd7c0)
    at escargot/src/parser/ast/ProgramNode.h:48
#10 0x00005555555e1789 in Escargot::ByteCodeGenerator::generateByteCode (this=0x7fffffffda17, c=0x7ffff7e59ed0, codeBlock=0x7ffff4831ed0, ast=0x7ffff482ee30, scopeCtx=0x7ffff7e68850, isEvalMode=false, 
    isOnGlobal=true, shouldGenerateLOCData=false) at src/interpreter/ByteCodeGenerator.cpp:188
#11 0x0000555555611635 in Escargot::Script::execute (this=0x7ffff4824190, state=..., isEvalMode=false, needNewEnv=false, isOnGlobal=true) at src/parser/Script.cpp:46
#12 0x0000555555611b73 in Escargot::Script::<lambda()>::operator()(void) const (__closure=0x7fffffffdd30) at src/parser/Script.cpp:93
#13 0x0000555555612c16 in std::_Function_handler<Escargot::Value(), Escargot::Script::sandboxExecute(Escargot::ExecutionState&)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...)
    at /usr/include/c++/7/bits/std_function.h:302
#14 0x00005555557a4106 in std::function<Escargot::Value ()>::operator()() const (this=0x7fffffffdd30) at /usr/include/c++/7/bits/std_function.h:706
#15 0x00005555557a2c4b in Escargot::SandBox::run(std::function<Escargot::Value ()> const&) (this=0x7fffffffdca0, scriptRunner=...) at src/runtime/SandBox.cpp:36
#16 0x0000555555611c50 in Escargot::Script::sandboxExecute (this=0x7ffff4824190, state=...) at src/parser/Script.cpp:94
#17 0x00005555557c102b in eval (context=0x7ffff7e59ed0, str=0x7ffff4829750, fileName=0x7ffff48296b0, shouldPrintScriptResult=false) at src/shell/Shell.cpp:46
#18 0x00005555557c197a in main (argc=2, argv=0x7fffffffe058) at src/shell/Shell.cpp:129

Found by Fuzzinator with grammarinator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant