Title: [212779] trunk/Source/_javascript_Core
Revision
212779
Author
[email protected]
Date
2017-02-21 17:01:16 -0800 (Tue, 21 Feb 2017)

Log Message

Add missing exception checks detected by running marathon.js.
https://bugs.webkit.org/show_bug.cgi?id=168687

Reviewed by Saam Barati.

When running the marathon.js test from https://bugs.webkit.org/show_bug.cgi?id=168580,
we get some crashes due to missing exception checks.  This patch adds those
missing exception checks.

* runtime/JSCJSValueInlines.h:
(JSC::JSValue::toPropertyKey):
* runtime/JSObject.cpp:
(JSC::JSObject::getPrimitiveNumber):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (212778 => 212779)


--- trunk/Source/_javascript_Core/ChangeLog	2017-02-22 00:58:15 UTC (rev 212778)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-02-22 01:01:16 UTC (rev 212779)
@@ -1,3 +1,19 @@
+2017-02-21  Mark Lam  <[email protected]>
+
+        Add missing exception checks detected by running marathon.js.
+        https://bugs.webkit.org/show_bug.cgi?id=168687
+
+        Reviewed by Saam Barati.
+
+        When running the marathon.js test from https://bugs.webkit.org/show_bug.cgi?id=168580,
+        we get some crashes due to missing exception checks.  This patch adds those
+        missing exception checks.
+
+        * runtime/JSCJSValueInlines.h:
+        (JSC::JSValue::toPropertyKey):
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::getPrimitiveNumber):
+
 2017-02-20  Filip Pizlo  <[email protected]>
 
         The collector thread should only start when the mutator doesn't have heap access

Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (212778 => 212779)


--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h	2017-02-22 00:58:15 UTC (rev 212778)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h	2017-02-22 01:01:16 UTC (rev 212779)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2012, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -638,12 +638,17 @@
 
 ALWAYS_INLINE Identifier JSValue::toPropertyKey(ExecState* exec) const
 {
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
     if (isString())
         return asString(*this)->toIdentifier(exec);
 
     JSValue primitive = toPrimitive(exec, PreferString);
+    RETURN_IF_EXCEPTION(scope, vm.propertyNames->emptyIdentifier);
     if (primitive.isSymbol())
         return Identifier::fromUid(asSymbol(primitive)->privateName());
+    scope.release();
     return primitive.toString(exec)->toIdentifier(exec);
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (212778 => 212779)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2017-02-22 00:58:15 UTC (rev 212778)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2017-02-22 01:01:16 UTC (rev 212779)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999-2001 Harri Porten ([email protected])
  *  Copyright (C) 2001 Peter Kelly ([email protected])
- *  Copyright (C) 2003-2006, 2008-2009, 2012-2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *  Copyright (C) 2007 Eric Seidel ([email protected])
  *
  *  This library is free software; you can redistribute it and/or
@@ -1972,7 +1972,12 @@
 
 bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const
 {
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
     result = toPrimitive(exec, PreferNumber);
+    RETURN_IF_EXCEPTION(scope, false);
+    scope.release();
     number = result.toNumber(exec);
     return !result.isString();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to