Title: [218771] trunk
- Revision
- 218771
- Author
- [email protected]
- Date
- 2017-06-23 16:06:48 -0700 (Fri, 23 Jun 2017)
Log Message
webrtc::WebRtcSession is not handling correctly its state when setLocalDescription fails and is called again
https://bugs.webkit.org/show_bug.cgi?id=173783
Patch by Youenn Fablet <[email protected]> on 2017-06-23
Reviewed by Alex Christensen.
Source/WebCore:
Test: webrtc/libwebrtc/setLocalDescriptionCrash.html
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): Fail early if there is no pending remote description and description is for an answer.
LayoutTests:
* webrtc/libwebrtc/setLocalDescriptionCrash-expected.txt: Added.
* webrtc/libwebrtc/setLocalDescriptionCrash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (218770 => 218771)
--- trunk/LayoutTests/ChangeLog 2017-06-23 22:50:42 UTC (rev 218770)
+++ trunk/LayoutTests/ChangeLog 2017-06-23 23:06:48 UTC (rev 218771)
@@ -1,3 +1,13 @@
+2017-06-23 Youenn Fablet <[email protected]>
+
+ webrtc::WebRtcSession is not handling correctly its state when setLocalDescription fails and is called again
+ https://bugs.webkit.org/show_bug.cgi?id=173783
+
+ Reviewed by Alex Christensen.
+
+ * webrtc/libwebrtc/setLocalDescriptionCrash-expected.txt: Added.
+ * webrtc/libwebrtc/setLocalDescriptionCrash.html: Added.
+
2017-06-23 Matt Lewis <[email protected]>
Added additional test expectations for webrtc/video-replace-muted-track.html.
Added: trunk/LayoutTests/webrtc/libwebrtc/setLocalDescriptionCrash-expected.txt (0 => 218771)
--- trunk/LayoutTests/webrtc/libwebrtc/setLocalDescriptionCrash-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/libwebrtc/setLocalDescriptionCrash-expected.txt 2017-06-23 23:06:48 UTC (rev 218771)
@@ -0,0 +1,3 @@
+
+PASS Testing calling twice setLocalDescription with a bad SDP
+
Added: trunk/LayoutTests/webrtc/libwebrtc/setLocalDescriptionCrash.html (0 => 218771)
--- trunk/LayoutTests/webrtc/libwebrtc/setLocalDescriptionCrash.html (rev 0)
+++ trunk/LayoutTests/webrtc/libwebrtc/setLocalDescriptionCrash.html 2017-06-23 23:06:48 UTC (rev 218771)
@@ -0,0 +1,40 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing erroneous setLocalDescription calls</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+function badifyAnswer(answer)
+{
+ return {type: answer.type, sdp: answer.sdp.replace("BUNDLE video", "BUNDLE")};
+}
+
+promise_test((test) => {
+ var pc1 = new RTCPeerConnection;
+ var pc2 = new RTCPeerConnection;
+ var badAnswer;
+
+ pc1.addTransceiver("video");
+ return pc1.createOffer().then((offer) => {
+ return pc1.setLocalDescription(offer);
+ }).then(() => {
+ return pc2.setRemoteDescription(pc1.localDescription);
+ }).then(() => {
+ return pc2.createAnswer();
+ }).then((answer) => {
+ badAnswer = badifyAnswer(answer);
+ return pc2.setLocalDescription(badAnswer);
+ }).then(assert_unreached, (e) => {
+ assert_equals(e.message, "Failed to set local answer sdp: Failed to enable BUNDLE.");
+ return pc2.setLocalDescription(badAnswer).then(assert_unreached, (e) => {
+ assert_equals(e.message, "Failed to set local answer sdp: no pending remote description.");
+ });
+ });
+}, "Testing calling twice setLocalDescription with a bad SDP");
+ </script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (218770 => 218771)
--- trunk/Source/WebCore/ChangeLog 2017-06-23 22:50:42 UTC (rev 218770)
+++ trunk/Source/WebCore/ChangeLog 2017-06-23 23:06:48 UTC (rev 218771)
@@ -1,3 +1,15 @@
+2017-06-23 Youenn Fablet <[email protected]>
+
+ webrtc::WebRtcSession is not handling correctly its state when setLocalDescription fails and is called again
+ https://bugs.webkit.org/show_bug.cgi?id=173783
+
+ Reviewed by Alex Christensen.
+
+ Test: webrtc/libwebrtc/setLocalDescriptionCrash.html
+
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): Fail early if there is no pending remote description and description is for an answer.
+
2017-06-23 Eric Carlson <[email protected]>
[MediaStream macOS] enumerateDevices should only return valid audio capture devices
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (218770 => 218771)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-06-23 22:50:42 UTC (rev 218770)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-06-23 23:06:48 UTC (rev 218771)
@@ -149,6 +149,13 @@
m_peerConnectionBackend.setLocalDescriptionFailed(Exception { OperationError, WTFMove(errorMessage) });
return;
}
+
+ // FIXME: See https://bugs.webkit.org/show_bug.cgi?id=173783. Remove this test once fixed at LibWebRTC level.
+ if (description.type() == RTCSdpType::Answer && !m_backend->pending_remote_description()) {
+ m_peerConnectionBackend.setLocalDescriptionFailed(Exception { INVALID_STATE_ERR, ASCIILiteral("Failed to set local answer sdp: no pending remote description.") });
+ return;
+ }
+
m_backend->SetLocalDescription(&m_setLocalSessionDescriptionObserver, sessionDescription.release());
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes