escargot
escargot copied to clipboard
Assertion `context->m_registerStack->size() == before' failed in Escargot::ExpressionStatementNode::generateStatementByteCode
Escargot
- OS: Ubuntu 20.04.5 LTS (Linux 5.4.0-144-generic x86_64)
- Revision : bd95de3c46e515a387ae1c3d0b214d9ddbd99e90
Build Steps
cmake -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=shell -GNinja
Describe the bug Assertion failure
Test case
testcase
a = [ ] ;
a = [ 0.1, 0.1, 0.1 ] ;
a. length = 1 ;
delete a [ 1 ] ;
a = delete a ;
delete a ;
a [ 0 ] ;
// poc.js
a = delete a ;
Execution steps & Output
$ ./escargot/escargot poc.js
escargot: src/parser/ast/ExpressionStatementNode.h:55: virtual void Escargot::ExpressionStatementNode::generateStatementByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*): Assertion `context->m_registerStack->size() == before' failed.
Aborted
Backtrace
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7a70859 in __GI_abort () at abort.c:79
#2 0x00007ffff7a70729 in __assert_fail_base (fmt=0x7ffff7c06588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x555555b1d830 "context->m_registerStack->size() == before", file=0x555555b1d800 "src/parser/ast/ExpressionStatementNode.h", line=55, function=<optimized out>)
at assert.c:92
#3 0x00007ffff7a81fd6 in __GI___assert_fail (assertion=0x555555b1d830 "context->m_registerStack->size() == before",
file=0x555555b1d800 "src/parser/ast/ExpressionStatementNode.h", line=55,
function=0x555555b1d778 "virtual void Escargot::ExpressionStatementNode::generateStatementByteCode(Escargot::ByteCodeBlock*, Escargot::ByteCodeGenerateContext*)")
at assert.c:101
#4 0x000055555580520b in Escargot::ExpressionStatementNode::generateStatementByteCode (this=0x555555d12b20, codeBlock=0xc1f50, context=0x7fffffffdb20)
at src/parser/ast/ExpressionStatementNode.h:55
#5 0x00005555557edef8 in Escargot::StatementContainer::generateStatementByteCode (this=0x555555d12ab0, codeBlock=0xc1f50, context=0x7fffffffdb20)
at src/parser/ast/StatementNode.h:107
#6 0x000055555580e65d in Escargot::ProgramNode::generateStatementByteCode (this=0x555555d12b40, codeBlock=0xc1f50, context=0x7fffffffdb20) at src/parser/ast/ProgramNode.h:48
#7 0x000055555570525c in Escargot::ByteCodeGenerator::generateByteCode (context=0xa3af0, codeBlock=0xbde30, ast=0x555555d12b40, inWithFromRuntime=false, cacheByteCode=false)
at src/interpreter/ByteCodeGenerator.cpp:272
#8 0x00005555557e5f8c in Escargot::ScriptParser::initializeScript (this=0x59f70, originSource=0x0, originLineOffset=0, source=0xabf70, srcName=0x7a390, parentCodeBlock=0x0,
isModule=false, isEvalMode=false, isEvalCodeInFunction=false, inWithOperation=false, strictFromOutside=false, allowSuperCall=false, allowSuperProperty=false,
allowNewTarget=false, needByteCodeGeneration=true) at src/parser/ScriptParser.cpp:455
#9 0x000055555563bec4 in Escargot::ScriptParser::initializeScript (this=0x59f70, source=0xabf70, srcName=0x7a390, isModule=false) at src/parser/ScriptParser.h:57
#10 0x000055555564333d in Escargot::ScriptParserRef::initializeScript (this=0x59f70, source=0xabf70, srcName=0x7a390, isModule=false) at src/api/EscargotPublic.cpp:4626
#11 0x00005555559a3d07 in evalScript (context=0xa3af0, source=0xabf70, srcName=0x7a390, shouldPrintScriptResult=false, isModule=false) at src/shell/Shell.cpp:751
#12 0x00005555559a52bd in main (argc=2, argv=0x7fffffffe348) at src/shell/Shell.cpp:1130
(gdb)
Expected behavior
true
Credits: @Ye0nny, @EJueon