Title: [202628] trunk
- Revision
- 202628
- Author
- commit-qu...@webkit.org
- Date
- 2016-06-29 10:36:33 -0700 (Wed, 29 Jun 2016)
Log Message
WebRTC: ice-char can not contain '=' characters for credentials
https://bugs.webkit.org/show_bug.cgi?id=159207
Patch by Alejandro G. Castro <a...@igalia.com> on 2016-06-29
Reviewed by Eric Carlson.
Source/WebCore:
Avoid a general calculation to get a base64 without padding which
was wrong in the randomString function. Because each parameter
using the function requires a different setup depending of the
specification and this is not a general API, it is a better
solution to calculate and store the sizes we want to use, comment
them and test them, considering we use base64 to generate the
strings we just need to avoid padding.
Existing test modified to match the correct behavior.
* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::randomString): Now the size is the one passed.
(WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
Used different valid values following the sdp parser in each case.
LayoutTests:
Modified the parser to make the regexp similar to the one we have
in WebCore.
* fast/mediastream/resources/sdp-utils.js:
(printComparableSessionDescription):
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (202627 => 202628)
--- trunk/LayoutTests/ChangeLog 2016-06-29 16:53:25 UTC (rev 202627)
+++ trunk/LayoutTests/ChangeLog 2016-06-29 17:36:33 UTC (rev 202628)
@@ -1,3 +1,16 @@
+2016-06-29 Alejandro G. Castro <a...@igalia.com>
+
+ WebRTC: ice-char can not contain '=' characters for credentials
+ https://bugs.webkit.org/show_bug.cgi?id=159207
+
+ Reviewed by Eric Carlson.
+
+ Modified the parser to make the regexp similar to the one we have
+ in WebCore.
+
+ * fast/mediastream/resources/sdp-utils.js:
+ (printComparableSessionDescription):
+
2016-06-29 David Kilzer <ddkil...@apple.com>
Crash when 'input' event handler for input[type=color] changes the input type
Modified: trunk/LayoutTests/fast/mediastream/resources/sdp-utils.js (202627 => 202628)
--- trunk/LayoutTests/fast/mediastream/resources/sdp-utils.js 2016-06-29 16:53:25 UTC (rev 202627)
+++ trunk/LayoutTests/fast/mediastream/resources/sdp-utils.js 2016-06-29 17:36:33 UTC (rev 202628)
@@ -15,7 +15,7 @@
"mid": "^a=mid:([!#$%&'*+-.\\w]*).*$",
"msid": "^a=(ssrc:\\d+ )?msid:([\\w+/\\-=]+) +([\\w+/\\-=]+).*$",
"iceufrag": "^a=ice-ufrag:([\\w+/]*).*$",
- "icepwd": "^a=ice-pwd:([\\w+/]*=*).*$",
+ "icepwd": "^a=ice-pwd:([\\w+/]*).*$",
};
var mdescIndex = -1;
Modified: trunk/Source/WebCore/ChangeLog (202627 => 202628)
--- trunk/Source/WebCore/ChangeLog 2016-06-29 16:53:25 UTC (rev 202627)
+++ trunk/Source/WebCore/ChangeLog 2016-06-29 17:36:33 UTC (rev 202628)
@@ -1,3 +1,25 @@
+2016-06-29 Alejandro G. Castro <a...@igalia.com>
+
+ WebRTC: ice-char can not contain '=' characters for credentials
+ https://bugs.webkit.org/show_bug.cgi?id=159207
+
+ Reviewed by Eric Carlson.
+
+ Avoid a general calculation to get a base64 without padding which
+ was wrong in the randomString function. Because each parameter
+ using the function requires a different setup depending of the
+ specification and this is not a general API, it is a better
+ solution to calculate and store the sizes we want to use, comment
+ them and test them, considering we use base64 to generate the
+ strings we just need to avoid padding.
+
+ Existing test modified to match the correct behavior.
+
+ * Modules/mediastream/MediaEndpointPeerConnection.cpp:
+ (WebCore::randomString): Now the size is the one passed.
+ (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
+ Used different valid values following the sdp parser in each case.
+
2016-06-29 David Kilzer <ddkil...@apple.com>
Crash when 'input' event handler for input[type=color] changes the input type
Modified: trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp (202627 => 202628)
--- trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp 2016-06-29 16:53:25 UTC (rev 202627)
+++ trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp 2016-06-29 17:36:33 UTC (rev 202628)
@@ -53,6 +53,13 @@
using namespace PeerConnection;
using namespace PeerConnectionStates;
+// We use base64 to generate the random strings so we need a size that avoids padding to get ice-chars.
+static const size_t cnameSize = 18;
+// Size range from 4 to 256 ice-chars defined in RFC 5245.
+static const size_t iceUfragSize = 6;
+// Size range from 22 to 256 ice-chars defined in RFC 5245.
+static const size_t icePasswordSize = 24;
+
static std::unique_ptr<PeerConnectionBackend> createMediaEndpointPeerConnection(PeerConnectionBackendClient* client)
{
return std::unique_ptr<PeerConnectionBackend>(new MediaEndpointPeerConnection(client));
@@ -60,9 +67,8 @@
CreatePeerConnectionBackend PeerConnectionBackend::create = createMediaEndpointPeerConnection;
-static String randomString(size_t length)
+static String randomString(size_t size)
{
- const size_t size = ceil(length * 3 / 4);
unsigned char randomValues[size];
cryptographicallyRandomValues(randomValues, size);
return base64Encode(randomValues, size);
@@ -72,9 +78,9 @@
: m_client(client)
, m_mediaEndpoint(MediaEndpoint::create(*this))
, m_sdpProcessor(std::unique_ptr<SDPProcessor>(new SDPProcessor(m_client->scriptExecutionContext())))
- , m_cname(randomString(16))
- , m_iceUfrag(randomString(4))
- , m_icePassword(randomString(22))
+ , m_cname(randomString(cnameSize))
+ , m_iceUfrag(randomString(iceUfragSize))
+ , m_icePassword(randomString(icePasswordSize))
{
ASSERT(m_mediaEndpoint);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes