Bug 158792
Summary: | OOM Assertion failure when Function constructor cannot create source string | ||
---|---|---|---|
Product: | WebKit | Reporter: | André Bargull <andre.bargull> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | ||
Priority: | P2 | ||
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
André Bargull
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
...
---
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
André Bargull
Test case no longer crashes at r228977. It now reports the following exception:
---
Exception: SyntaxError: Invalid character: '\0'
---
Alexey Proskuryakov
At least on macOS, I'm now seeing an OOM exception, which seems like correct behavior.
>>> var p = "a".repeat(0x7ffffff)
undefined
>>> var r = Function(
... p, p, p, p, p,
... p, p, p, p, p,
... p, p, p, p, p,
... p, p, p, p, p
... );
Exception: RangeError: Out of memory