Bug 158796

Summary: Assertion failure or crash when accessing let-variable in TDZ with eval with a function in it that returns let variable
Product: WebKit Reporter: André Bargull <andre.bargull>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, keith_miller, mark.lam, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch msaboff: review+

Description André Bargull 2016-06-15 10:26:34 PDT
SVN: rev202088
Build with: perl Tools/Scripts/build-jsc --gtk --debug


The following test case triggers this assertion error:
---
ASSERTION FAILED: returnValue
---


Test case:
---
{ let b = {a: eval("function b(){ return b; }"), b: (1, eval)("(b())")}; }
---


Stack trace:
---
#0  0x00007ffff6de7098 in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:317
#1  0x00007ffff694c7dc in JSC::checkedReturn (returnValue=...) at ../../Source/JavaScriptCore/interpreter/Interpreter.cpp:809
#2  0x00007ffff694f249 in JSC::Interpreter::execute (this=0x7ffff0def058, eval=0x7fffaf1fbe50, callFrame=0x7fffffffcb00, thisValue=..., scope=0x7fffaf1dbfc0)
    at ../../Source/JavaScriptCore/interpreter/Interpreter.cpp:1237
#3  0x00007ffff6bd3d41 in JSC::globalFuncEval (exec=0x7fffffffcb00) at ../../Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:673
...
---


Alternative test case which crashes:
---
{ let {b} = {a: eval("function b(){ return b; }"), b: (1, eval)("print(b())")}; }
---

Stack trace:
---
#0  0x0000000000448df0 in JSC::JSCell::isString (this=0x0) at ../../Source/JavaScriptCore/runtime/JSCellInlines.h:160
#1  0x0000000000449be6 in JSC::JSValue::isString (this=0x7fffffffbe50) at ../../Source/JavaScriptCore/runtime/JSCJSValueInlines.h:553
#2  0x00000000004445d8 in JSC::JSValue::toString (this=0x7fffffffbe50, exec=0x7fffffffbec0) at ../../Source/JavaScriptCore/runtime/JSString.h:765
#3  0x000000000043556f in functionPrint (exec=0x7fffffffbec0) at ../../Source/JavaScriptCore/jsc.cpp:1143
...
---
Comment 1 Radar WebKit Bug Importer 2016-06-23 16:02:34 PDT
<rdar://problem/26984659>
Comment 2 Saam Barati 2016-06-28 17:38:40 PDT
Created attachment 282304 [details]
patch
Comment 3 Michael Saboff 2016-06-28 17:40:01 PDT
Comment on attachment 282304 [details]
patch

r=me
Comment 4 Saam Barati 2016-06-28 19:06:56 PDT
landed in:
https://trac.webkit.org/changeset/202602