Changeset 202628 in webkit


Ignore:
Timestamp:
Jun 29, 2016 10:36:33 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

WebRTC: ice-char can not contain '=' characters for credentials
https://bugs.webkit.org/show_bug.cgi?id=159207

Patch by Alejandro G. Castro <alex@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):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202626 r202628  
     12016-06-29  Alejandro G. Castro  <alex@igalia.com>
     2
     3        WebRTC: ice-char can not contain '=' characters for credentials
     4        https://bugs.webkit.org/show_bug.cgi?id=159207
     5
     6        Reviewed by Eric Carlson.
     7
     8        Modified the parser to make the regexp similar to the one we have
     9        in WebCore.
     10
     11        * fast/mediastream/resources/sdp-utils.js:
     12        (printComparableSessionDescription):
     13
    1142016-06-29  David Kilzer  <ddkilzer@apple.com>
    215
  • trunk/LayoutTests/fast/mediastream/resources/sdp-utils.js

    r201728 r202628  
    1616            "msid": "^a=(ssrc:\\d+ )?msid:([\\w+/\\-=]+) +([\\w+/\\-=]+).*$",
    1717            "iceufrag": "^a=ice-ufrag:([\\w+/]*).*$",
    18             "icepwd": "^a=ice-pwd:([\\w+/]*=*).*$",
     18            "icepwd": "^a=ice-pwd:([\\w+/]*).*$",
    1919        };
    2020
  • trunk/Source/WebCore/ChangeLog

    r202626 r202628  
     12016-06-29  Alejandro G. Castro  <alex@igalia.com>
     2
     3        WebRTC: ice-char can not contain '=' characters for credentials
     4        https://bugs.webkit.org/show_bug.cgi?id=159207
     5
     6        Reviewed by Eric Carlson.
     7
     8        Avoid a general calculation to get a base64 without padding which
     9        was wrong in the randomString function. Because each parameter
     10        using the function requires a different setup depending of the
     11        specification and this is not a general API, it is a better
     12        solution to calculate and store the sizes we want to use, comment
     13        them and test them, considering we use base64 to generate the
     14        strings we just need to avoid padding.
     15
     16        Existing test modified to match the correct behavior.
     17
     18        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
     19        (WebCore::randomString): Now the size is the one passed.
     20        (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
     21        Used different valid values following the sdp parser in each case.
     22
    1232016-06-29  David Kilzer  <ddkilzer@apple.com>
    224
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp

    r202624 r202628  
    5454using namespace PeerConnectionStates;
    5555
     56// We use base64 to generate the random strings so we need a size that avoids padding to get ice-chars.
     57static const size_t cnameSize = 18;
     58// Size range from 4 to 256 ice-chars defined in RFC 5245.
     59static const size_t iceUfragSize = 6;
     60// Size range from 22 to 256 ice-chars defined in RFC 5245.
     61static const size_t icePasswordSize = 24;
     62
    5663static std::unique_ptr<PeerConnectionBackend> createMediaEndpointPeerConnection(PeerConnectionBackendClient* client)
    5764{
     
    6168CreatePeerConnectionBackend PeerConnectionBackend::create = createMediaEndpointPeerConnection;
    6269
    63 static String randomString(size_t length)
    64 {
    65     const size_t size = ceil(length * 3 / 4);
     70static String randomString(size_t size)
     71{
    6672    unsigned char randomValues[size];
    6773    cryptographicallyRandomValues(randomValues, size);
     
    7379    , m_mediaEndpoint(MediaEndpoint::create(*this))
    7480    , m_sdpProcessor(std::unique_ptr<SDPProcessor>(new SDPProcessor(m_client->scriptExecutionContext())))
    75     , m_cname(randomString(16))
    76     , m_iceUfrag(randomString(4))
    77     , m_icePassword(randomString(22))
     81    , m_cname(randomString(cnameSize))
     82    , m_iceUfrag(randomString(iceUfragSize))
     83    , m_icePassword(randomString(icePasswordSize))
    7884{
    7985    ASSERT(m_mediaEndpoint);
Note: See TracChangeset for help on using the changeset viewer.