Skip to content

Commit c8c1956

Browse files
committed
2010-07-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak. Crash entering mail.yahoo.com https://bugs.webkit.org/show_bug.cgi?id=42394 * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::argumentNumberFor): Added a NULL check. If the identifier we're resolving is not a local variable, registerFor returns NULL. * bytecompiler/NodesCodegen.cpp: (JSC::FunctionBodyNode::emitBytecode): Unrelated to the crash, but I noticed this while working on it: No need to NULL-check returnNode, since an early return has already done so. 2010-07-15 Geoffrey Garen <ggaren@apple.com> Reviewed by Maciej Stachowiak. Test for https://bugs.webkit.org/show_bug.cgi?id=42394 Crash entering mail.yahoo.com * fast/js/numeric-compare.html: Added. * fast/js/script-tests/numeric-compare.js: Added. Canonical link: https://commits.webkit.org/54355@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent d916f7d commit c8c1956

6 files changed

Lines changed: 53 additions & 2 deletions

File tree

JavaScriptCore/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2010-07-15 Geoffrey Garen <ggaren@apple.com>
2+
3+
Reviewed by Maciej Stachowiak.
4+
5+
Crash entering mail.yahoo.com
6+
https://bugs.webkit.org/show_bug.cgi?id=42394
7+
8+
* bytecompiler/BytecodeGenerator.cpp:
9+
(JSC::BytecodeGenerator::argumentNumberFor): Added a NULL check. If the
10+
identifier we're resolving is not a local variable, registerFor returns
11+
NULL.
12+
13+
* bytecompiler/NodesCodegen.cpp:
14+
(JSC::FunctionBodyNode::emitBytecode): Unrelated to the crash, but I
15+
noticed this while working on it: No need to NULL-check returnNode,
16+
since an early return has already done so.
17+
118
2010-07-15 Martin Robinson <mrobinson@igalia.com>
219

320
Reviewed by Oliver Hunt.

JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,10 @@ void BytecodeGenerator::setIsNumericCompareFunction(bool isNumericCompareFunctio
20512051
int BytecodeGenerator::argumentNumberFor(const Identifier& ident)
20522052
{
20532053
int parameterCount = m_parameters.size(); // includes 'this'
2054-
int index = registerFor(ident)->index() + RegisterFile::CallFrameHeaderSize + parameterCount;
2054+
RegisterID* registerID = registerFor(ident);
2055+
if (!registerID)
2056+
return 0;
2057+
int index = registerID->index() + RegisterFile::CallFrameHeaderSize + parameterCount;
20552058
return (index > 0 && index < parameterCount) ? index : 0;
20562059
}
20572060

JavaScriptCore/bytecompiler/NodesCodegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ RegisterID* FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, Registe
20362036
}
20372037

20382038
// If there is a return statment, and it is the only statement in the function, check if this is a numeric compare.
2039-
if (returnNode && static_cast<BlockNode*>(singleStatement)->singleStatement()) {
2039+
if (static_cast<BlockNode*>(singleStatement)->singleStatement()) {
20402040
ExpressionNode* returnValueExpression = returnNode->value();
20412041
if (returnValueExpression && returnValueExpression->isSubtract()) {
20422042
ExpressionNode* lhsExpression = static_cast<SubNode*>(returnValueExpression)->lhs();

LayoutTests/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2010-07-15 Geoffrey Garen <ggaren@apple.com>
2+
3+
Reviewed by Maciej Stachowiak.
4+
5+
Test for https://bugs.webkit.org/show_bug.cgi?id=42394
6+
Crash entering mail.yahoo.com
7+
8+
* fast/js/numeric-compare.html: Added.
9+
* fast/js/script-tests/numeric-compare.js: Added.
10+
111
2010-07-15 Adam Barth <abarth@webkit.org>
212

313
Followup to https://bugs.webkit.org/show_bug.cgi?id=42214
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2+
<html>
3+
<head>
4+
<link rel="stylesheet" href="resources/js-test-style.css">
5+
<script src="resources/js-test-pre.js"></script>
6+
</head>
7+
<body>
8+
<p id="description"></p>
9+
<div id="console"></div>
10+
<script src="script-tests/numeric-compare.js"></script>
11+
<script src="resources/js-test-post.js"></script>
12+
</body>
13+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
description(
2+
'Tests that compiling a numeric comparison function does not crash'
3+
);
4+
5+
var a, b;
6+
(function () { return a - b; })();
7+
8+
var successfullyParsed = true;

0 commit comments

Comments
 (0)