Title: [116530] trunk
- Revision
- 116530
- Author
- [email protected]
- Date
- 2012-05-09 08:55:58 -0700 (Wed, 09 May 2012)
Log Message
MediaStream API: SessionDescription::addCandidate should not crash for malformed input
https://bugs.webkit.org/show_bug.cgi?id=85988
Reviewed by Adam Barth.
Source/WebCore:
Sending null would crash the browser. Added safeguards in both the bindings and the native code.
Test: fast/mediastream/SessionDescription.html
* Modules/mediastream/SessionDescription.cpp:
(WebCore::SessionDescription::addCandidate):
* Modules/mediastream/SessionDescription.h:
(SessionDescription):
* Modules/mediastream/SessionDescription.idl:
LayoutTests:
* fast/mediastream/SessionDescription-expected.txt: Added.
* fast/mediastream/SessionDescription.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (116529 => 116530)
--- trunk/LayoutTests/ChangeLog 2012-05-09 15:49:04 UTC (rev 116529)
+++ trunk/LayoutTests/ChangeLog 2012-05-09 15:55:58 UTC (rev 116530)
@@ -1,3 +1,13 @@
+2012-05-09 Tommy Widenflycht <[email protected]>
+
+ MediaStream API: SessionDescription::addCandidate should not crash for malformed input
+ https://bugs.webkit.org/show_bug.cgi?id=85988
+
+ Reviewed by Adam Barth.
+
+ * fast/mediastream/SessionDescription-expected.txt: Added.
+ * fast/mediastream/SessionDescription.html: Added.
+
2012-05-09 Takashi Sakamoto <[email protected]>
Crash in WebCore::RenderBoxModelObject::paddingLeft
Added: trunk/LayoutTests/fast/mediastream/SessionDescription-expected.txt (0 => 116530)
--- trunk/LayoutTests/fast/mediastream/SessionDescription-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/mediastream/SessionDescription-expected.txt 2012-05-09 15:55:58 UTC (rev 116530)
@@ -0,0 +1,16 @@
+Tests the JSEP SessionDescription.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS sessionDescription = new SessionDescription(''); did not throw exception.
+PASS sessionDescription.addCandidate() threw exception TypeError: Not enough arguments.
+PASS sessionDescription.addCandidate(null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS sessionDescription.addCandidate(undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS sessionDescription.addCandidate(42) threw exception TypeError: Type error.
+PASS iceCandidate = new IceCandidate('', ''); did not throw exception.
+PASS sessionDescription.addCandidate(iceCandidate) did not throw exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/mediastream/SessionDescription.html (0 => 116530)
--- trunk/LayoutTests/fast/mediastream/SessionDescription.html (rev 0)
+++ trunk/LayoutTests/fast/mediastream/SessionDescription.html 2012-05-09 15:55:58 UTC (rev 116530)
@@ -0,0 +1,27 @@
+<!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>
+description("Tests the JSEP SessionDescription.");
+
+sessionDescription = null;
+shouldNotThrow("sessionDescription = new SessionDescription('');");
+shouldThrow("sessionDescription.addCandidate()");
+shouldThrow("sessionDescription.addCandidate(null)");
+shouldThrow("sessionDescription.addCandidate(undefined)");
+shouldThrow("sessionDescription.addCandidate(42)");
+iceCandidate = null;
+shouldNotThrow("iceCandidate = new IceCandidate('', '');");
+shouldNotThrow("sessionDescription.addCandidate(iceCandidate)");
+
+window.jsTestIsAsync = false;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (116529 => 116530)
--- trunk/Source/WebCore/ChangeLog 2012-05-09 15:49:04 UTC (rev 116529)
+++ trunk/Source/WebCore/ChangeLog 2012-05-09 15:55:58 UTC (rev 116530)
@@ -1,5 +1,22 @@
2012-05-09 Tommy Widenflycht <[email protected]>
+ MediaStream API: SessionDescription::addCandidate should not crash for malformed input
+ https://bugs.webkit.org/show_bug.cgi?id=85988
+
+ Reviewed by Adam Barth.
+
+ Sending null would crash the browser. Added safeguards in both the bindings and the native code.
+
+ Test: fast/mediastream/SessionDescription.html
+
+ * Modules/mediastream/SessionDescription.cpp:
+ (WebCore::SessionDescription::addCandidate):
+ * Modules/mediastream/SessionDescription.h:
+ (SessionDescription):
+ * Modules/mediastream/SessionDescription.idl:
+
+2012-05-09 Tommy Widenflycht <[email protected]>
+
MediaStream API: Adding the possibility of port specific information in MediaStreamDescriptor
https://bugs.webkit.org/show_bug.cgi?id=85794
Modified: trunk/Source/WebCore/Modules/mediastream/SessionDescription.cpp (116529 => 116530)
--- trunk/Source/WebCore/Modules/mediastream/SessionDescription.cpp 2012-05-09 15:49:04 UTC (rev 116529)
+++ trunk/Source/WebCore/Modules/mediastream/SessionDescription.cpp 2012-05-09 15:55:58 UTC (rev 116530)
@@ -34,6 +34,7 @@
#include "SessionDescription.h"
+#include "ExceptionCode.h"
#include "IceCandidate.h"
#include "IceCandidateDescriptor.h"
#include "MediaStreamCenter.h"
@@ -61,8 +62,13 @@
{
}
-void SessionDescription::addCandidate(PassRefPtr<IceCandidate> candidate)
+void SessionDescription::addCandidate(PassRefPtr<IceCandidate> candidate, ExceptionCode& ec)
{
+ if (!candidate) {
+ ec = TYPE_MISMATCH_ERR;
+ return;
+ }
+
m_descriptor->addCandidate(candidate->descriptor());
}
Modified: trunk/Source/WebCore/Modules/mediastream/SessionDescription.h (116529 => 116530)
--- trunk/Source/WebCore/Modules/mediastream/SessionDescription.h 2012-05-09 15:49:04 UTC (rev 116529)
+++ trunk/Source/WebCore/Modules/mediastream/SessionDescription.h 2012-05-09 15:55:58 UTC (rev 116530)
@@ -33,6 +33,7 @@
#if ENABLE(MEDIA_STREAM)
+#include "ExceptionBase.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -48,7 +49,7 @@
static PassRefPtr<SessionDescription> create(PassRefPtr<SessionDescriptionDescriptor>);
virtual ~SessionDescription();
- void addCandidate(PassRefPtr<IceCandidate>);
+ void addCandidate(PassRefPtr<IceCandidate>, ExceptionCode&);
String toSdp();
SessionDescriptionDescriptor* descriptor();
Modified: trunk/Source/WebCore/Modules/mediastream/SessionDescription.idl (116529 => 116530)
--- trunk/Source/WebCore/Modules/mediastream/SessionDescription.idl 2012-05-09 15:49:04 UTC (rev 116529)
+++ trunk/Source/WebCore/Modules/mediastream/SessionDescription.idl 2012-05-09 15:55:58 UTC (rev 116530)
@@ -34,7 +34,8 @@
Conditional=MEDIA_STREAM,
Constructor(in DOMString sdp)
] SessionDescription {
- void addCandidate(in IceCandidate candidate);
+ [StrictTypeChecking] void addCandidate(in IceCandidate candidate)
+ raises(DOMException);
DOMString toSdp();
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes