Title: [154011] trunk/Source/_javascript_Core
Revision
154011
Author
[email protected]
Date
2013-08-13 10:49:52 -0700 (Tue, 13 Aug 2013)

Log Message

Harden executeConstruct against incorrect return types from host functions
https://bugs.webkit.org/show_bug.cgi?id=119757

Reviewed by Mark Hahnenberg.

Add logic to guard against bogus return types.  There doesn't seem to be any
class in webkit that does this wrong, but the typed array stubs in debug JSC
do exhibit this bad behaviour.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeConstruct):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (154010 => 154011)


--- trunk/Source/_javascript_Core/ChangeLog	2013-08-13 17:49:23 UTC (rev 154010)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-08-13 17:49:52 UTC (rev 154011)
@@ -1,3 +1,17 @@
+2013-08-13  Oliver Hunt  <[email protected]>
+
+        Harden executeConstruct against incorrect return types from host functions
+        https://bugs.webkit.org/show_bug.cgi?id=119757
+
+        Reviewed by Mark Hahnenberg.
+
+        Add logic to guard against bogus return types.  There doesn't seem to be any
+        class in webkit that does this wrong, but the typed array stubs in debug JSC
+        do exhibit this bad behaviour.
+
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::executeConstruct):
+
 2013-08-13  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt] Fix C++11 build with gcc 4.4 and 4.5

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (154010 => 154011)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-08-13 17:49:23 UTC (rev 154010)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-08-13 17:49:52 UTC (rev 154011)
@@ -1004,8 +1004,14 @@
 #elif ENABLE(JIT)
             result = constructData.js.functionExecutable->generatedJITCodeForConstruct()->execute(&m_stack, newCallFrame, &vm);
 #endif // ENABLE(JIT)
-        } else
+        } else {
             result = JSValue::decode(constructData.native.function(newCallFrame));
+            if (!callFrame->hadException()) {
+                ASSERT_WITH_MESSAGE(result.isObject(), "Host constructor returned non object.");
+                if (!result.isObject())
+                    throwTypeError(newCallFrame);
+            }
+        }
     }
 
     if (LegacyProfiler* profiler = vm.enabledProfiler())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to