Changeset 207684 in webkit
- Timestamp:
- Oct 21, 2016 10:49:30 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r207671 r207684 1 2016-10-21 Caitlin Potter <caitp@igalia.com> 2 3 [JSC] don't crash when arguments to `new Function()` produce unexpected AST 4 https://bugs.webkit.org/show_bug.cgi?id=163748 5 6 Reviewed by Mark Lam. 7 8 * stress/regress-163748.js: Added. 9 (assert): 10 (shouldThrowSyntaxError): 11 (GeneratorFunction): 12 1 13 2016-10-20 Keith Miller <keith_miller@apple.com> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r207671 r207684 1 2016-10-21 Caitlin Potter <caitp@igalia.com> 2 3 [JSC] don't crash when arguments to `new Function()` produce unexpected AST 4 https://bugs.webkit.org/show_bug.cgi?id=163748 5 6 Reviewed by Mark Lam. 7 8 The ASSERT(statement); and ASSERT(funcDecl); lines are removed, replaced with blocks 9 to report a generic Parser error message. These lines are only possible to be reached 10 if the input string produced an unexpected AST, which previously could be used to crash 11 the process via ASSERT failure. 12 13 The node type assertions are left in the tree, as it should be impossible for a top-level 14 `{` to produce anything other than a Block node. If the node turns out not to be a Block, 15 it indicates that the (C++) caller of this function (E.g in FunctionConstructor.cpp), is 16 doing something incorrect. Similarly, it should be impossible for the `funcDecl` node to 17 be anything other than a function declaration given the conventions of the caller of this 18 function. 19 20 * runtime/CodeCache.cpp: 21 (JSC::CodeCache::getFunctionExecutableFromGlobalCode): 22 1 23 2016-10-20 Keith Miller <keith_miller@apple.com> 2 24 -
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r207618 r207684 183 183 // This function assumes an input string that would result in a single function declaration. 184 184 StatementNode* statement = program->singleStatement(); 185 ASSERT(statement); 185 if (UNLIKELY(!statement)) { 186 JSToken token; 187 error = ParserError(ParserError::SyntaxError, ParserError::SyntaxErrorIrrecoverable, token, "Parser error", -1); 188 return nullptr; 189 } 186 190 ASSERT(statement->isBlock()); 187 if (!statement || !statement->isBlock())188 return nullptr;189 191 190 192 StatementNode* funcDecl = static_cast<BlockNode*>(statement)->singleStatement(); 191 ASSERT(funcDecl); 193 if (UNLIKELY(!funcDecl)) { 194 JSToken token; 195 error = ParserError(ParserError::SyntaxError, ParserError::SyntaxErrorIrrecoverable, token, "Parser error", -1); 196 return nullptr; 197 } 192 198 ASSERT(funcDecl->isFuncDeclNode()); 193 if (!funcDecl || !funcDecl->isFuncDeclNode())194 return nullptr;195 199 196 200 FunctionMetadataNode* metadata = static_cast<FuncDeclNode*>(funcDecl)->metadata();
Note: See TracChangeset
for help on using the changeset viewer.