Bug 158792 - OOM Assertion failure when Function constructor cannot create source string
Summary: OOM Assertion failure when Function constructor cannot create source string
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-15 10:23 PDT by André Bargull
Modified: 2018-02-27 12:03 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description André Bargull 2016-06-15 10:23:16 PDT
SVN: rev202088
Build with: perl Tools/Scripts/build-jsc --gtk --debug


The following test case triggers this assertion error:
---
ASSERTION FAILED: !(length & is16BitStringFlag)
---


Test case:
---
var p = "a".repeat(0x7ffffff)
var r = Function(
  p, p, p, p, p,
  p, p, p, p, p,
  p, p, p, p, p,
  p, p, p, p, p
);
---


Stack trace:
---
#0  0x00007ffff6de7098 in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:317
#1  0x0000000000440c6c in WTF::StringView::initialize (this=0x7fffffffc4d0, characters=0x7ffc45c00014 "{function anonymous(", 'a' <repeats 180 times>..., 
    length=2684354603) at ../../Source/WTF/wtf/text/StringView.h:257
#2  0x0000000000440dd8 in WTF::StringView::StringView (this=0x7fffffffc4d0, string=...) at ../../Source/WTF/wtf/text/StringView.h:285
#3  0x0000000000441f7e in JSC::StringSourceProvider::source (this=0x7ffff0dece40) at ../../Source/JavaScriptCore/parser/SourceProvider.h:96
#4  0x00000000004420ae in JSC::SourceCode::SourceCode (this=0x7fffffffc660, provider=..., firstLine=1, startColumn=1)
    at ../../Source/JavaScriptCore/parser/SourceCode.h:65
#5  0x00000000004422d0 in JSC::makeSource (source=..., url=..., startPosition=...) at ../../Source/JavaScriptCore/parser/SourceCode.h:124
#6  0x00007ffff6b60f1f in JSC::constructFunctionSkippingEvalEnabledCheck (exec=0x7fffffffca90, globalObject=0x7fffaf1e7900, args=..., functionName=..., sourceURL=..., 
    position=..., overrideLineNumber=-1, functionConstructionMode=JSC::FunctionConstructionMode::Function, newTarget=...)
    at ../../Source/JavaScriptCore/runtime/FunctionConstructor.cpp:119
#7  0x00007ffff6b609fa in JSC::constructFunction (exec=0x7fffffffca90, globalObject=0x7fffaf1e7900, args=..., functionName=..., sourceURL=..., position=..., 
    functionConstructionMode=JSC::FunctionConstructionMode::Function, newTarget=...) at ../../Source/JavaScriptCore/runtime/FunctionConstructor.cpp:86
#8  0x00007ffff6b611ea in JSC::constructFunction (exec=0x7fffffffca90, globalObject=0x7fffaf1e7900, args=..., 
    functionConstructionMode=JSC::FunctionConstructionMode::Function, newTarget=...) at ../../Source/JavaScriptCore/runtime/FunctionConstructor.cpp:137
#9  0x00007ffff6b60900 in JSC::callFunctionConstructor (exec=0x7fffffffca90) at ../../Source/JavaScriptCore/runtime/FunctionConstructor.cpp:71
...
---
Comment 1 André Bargull 2018-02-27 12:03:30 PST
Test case no longer crashes at r228977. It now reports the following exception:
---
Exception: SyntaxError: Invalid character: '\0'
---