Title: [106275] trunk
- Revision
- 106275
- Author
- tom...@google.com
- Date
- 2012-01-30 12:25:15 -0800 (Mon, 30 Jan 2012)
Log Message
Memory leak caused by PeerConnection add a NULL media stream
https://bugs.webkit.org/show_bug.cgi?id=76150
Source/WebCore:
It was my missunderstanding that the IDL keyword [StrictTypeChecking] also protects against
null or undefined arguments, it doesn't. Added checks for null pointers.
Reviewed by Adam Barth.
Test: fast/mediastream/peerconnection-addstream.html
* mediastream/PeerConnection.cpp:
(WebCore::PeerConnection::addStream):
(WebCore::PeerConnection::removeStream):
LayoutTests:
Added a basic LayoutTest for null/undefined arguments to PeerConnection::addStream().
Reviewed by Adam Barth.
* fast/mediastream/peerconnection-addstream-expected.txt: Added.
* fast/mediastream/peerconnection-addstream.html: Added.
* fast/mediastream/script-tests/peerconnection-addstream.js: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (106274 => 106275)
--- trunk/LayoutTests/ChangeLog 2012-01-30 20:01:39 UTC (rev 106274)
+++ trunk/LayoutTests/ChangeLog 2012-01-30 20:25:15 UTC (rev 106275)
@@ -1,3 +1,16 @@
+2012-01-30 Tommy Widenflycht <tom...@google.com>
+
+ Memory leak caused by PeerConnection add a NULL media stream
+ https://bugs.webkit.org/show_bug.cgi?id=76150
+
+ Added a basic LayoutTest for null/undefined arguments to PeerConnection::addStream().
+
+ Reviewed by Adam Barth.
+
+ * fast/mediastream/peerconnection-addstream-expected.txt: Added.
+ * fast/mediastream/peerconnection-addstream.html: Added.
+ * fast/mediastream/script-tests/peerconnection-addstream.js: Added.
+
2012-01-30 Greg Billock <gbill...@google.com>
Enable web intents layout tests for Chromium build.
Added: trunk/LayoutTests/fast/mediastream/peerconnection-addstream-expected.txt (0 => 106275)
--- trunk/LayoutTests/fast/mediastream/peerconnection-addstream-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/mediastream/peerconnection-addstream-expected.txt 2012-01-30 20:25:15 UTC (rev 106275)
@@ -0,0 +1,13 @@
+Tests PeerConnection::addStream().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS pc.addStream() threw TypeError: Not enough arguments
+PASS pc.addStream(undefined) threw Error: TYPE_MISMATCH_ERR: DOM Exception 17
+PASS pc.addStream(null) threw Error: TYPE_MISMATCH_ERR: DOM Exception 17
+PASS pc.addStream(new Array()) threw TypeError: Type error
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/mediastream/peerconnection-addstream.html (0 => 106275)
--- trunk/LayoutTests/fast/mediastream/peerconnection-addstream.html (rev 0)
+++ trunk/LayoutTests/fast/mediastream/peerconnection-addstream.html 2012-01-30 20:25:15 UTC (rev 106275)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-addstream.js (0 => 106275)
--- trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-addstream.js (rev 0)
+++ trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-addstream.js 2012-01-30 20:25:15 UTC (rev 106275)
@@ -0,0 +1,32 @@
+description("Tests PeerConnection::addStream().");
+
+var pc = new webkitPeerConnection("STUN some.server.com", function() {});
+
+try {
+ pc.addStream();
+} catch(e) {
+ testPassed('pc.addStream() threw ' + e);
+}
+
+try {
+ pc.addStream(undefined);
+} catch(e) {
+ testPassed('pc.addStream(undefined) threw ' + e);
+}
+
+try {
+ pc.addStream(null);
+} catch(e) {
+ testPassed('pc.addStream(null) threw ' + e);
+}
+
+try {
+ pc.addStream(new Array());
+} catch(e) {
+ testPassed('pc.addStream(new Array()) threw ' + e);
+}
+
+finishJSTest();
+
+window.successfullyParsed = true;
+
Modified: trunk/Source/WebCore/ChangeLog (106274 => 106275)
--- trunk/Source/WebCore/ChangeLog 2012-01-30 20:01:39 UTC (rev 106274)
+++ trunk/Source/WebCore/ChangeLog 2012-01-30 20:25:15 UTC (rev 106275)
@@ -1,3 +1,19 @@
+2012-01-30 Tommy Widenflycht <tom...@google.com>
+
+ Memory leak caused by PeerConnection add a NULL media stream
+ https://bugs.webkit.org/show_bug.cgi?id=76150
+
+ It was my missunderstanding that the IDL keyword [StrictTypeChecking] also protects against
+ null or undefined arguments, it doesn't. Added checks for null pointers.
+
+ Reviewed by Adam Barth.
+
+ Test: fast/mediastream/peerconnection-addstream.html
+
+ * mediastream/PeerConnection.cpp:
+ (WebCore::PeerConnection::addStream):
+ (WebCore::PeerConnection::removeStream):
+
2012-01-26 Andy Estes <aes...@apple.com>
[Windows] Optionally invert colors when drawing to a WebView's backing store.
Modified: trunk/Source/WebCore/mediastream/PeerConnection.cpp (106274 => 106275)
--- trunk/Source/WebCore/mediastream/PeerConnection.cpp 2012-01-30 20:01:39 UTC (rev 106274)
+++ trunk/Source/WebCore/mediastream/PeerConnection.cpp 2012-01-30 20:25:15 UTC (rev 106275)
@@ -115,15 +115,17 @@
void PeerConnection::addStream(PassRefPtr<MediaStream> prpStream, ExceptionCode& ec)
{
+ RefPtr<MediaStream> stream = prpStream;
+ if (!stream) {
+ ec = TYPE_MISMATCH_ERR;
+ return;
+ }
+
if (m_readyState == CLOSED) {
ec = INVALID_STATE_ERR;
return;
}
- // The MediaStream object is guaranteed to exist since StrictTypeChecking is set in the idl.
-
- RefPtr<MediaStream> stream = prpStream;
-
if (m_localStreams->contains(stream.get()))
return;
@@ -148,7 +150,10 @@
return;
}
- // The MediaStream object is guaranteed to exist since StrictTypeChecking is set in the idl.
+ if (!stream) {
+ ec = TYPE_MISMATCH_ERR;
+ return;
+ }
if (!m_localStreams->contains(stream))
return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes