Bug 203190 - Carriage return character sometimes missing in SDP c-line
Summary: Carriage return character sometimes missing in SDP c-line
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 13
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-21 03:08 PDT by Lorenzo Miniero
Modified: 2019-10-22 12:04 PDT (History)
11 users (show)

See Also:


Attachments
Patch (4.67 KB, patch)
2019-10-21 23:47 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Miniero 2019-10-21 03:08:37 PDT
Apparently, when preparing the SDP offer for a datachannel-only PeerConnection, the c-line of the m-line is sometimes missing the carriage return character ('\r') and only has the line feed ('\n'). We discovered this because parsing the offer would fail in our server implementation (Janus) because of a missing 'ice-ufrag': the ICE ufrag is actually there, but line splitting fails because it expects '\r\n'.

There are some more details on an issue on our Github: https://github.com/meetecho/janus-gateway/issues/1818

Specifically, this is the offer we receive from Safari:

v=0\r\no=- 5579826872295925204 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\na=ice-ufrag:NRdu\r\na=ice-pwd:FLroZ+qxtf13ODODXHRjA/H4\r\na=ice-options:trickle\r\na=fingerprint:sha-256 1B:40:00:74:A7:C7:13:2D:55:D6:ED:5D:B4:67:DB:2D:D7:DD:68:0A:33:B1:13:CF:96:FC:30:C5:22:22:E8:52\r\na=setup:actpass\r\na=mid:0\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n

You can see the problem in the c-line:

    c=IN IP4 0.0.0.0\na=ice-ufrag:NRdu\r\n

This seems to be happening on Safari 13, both desktop and iOS, according to the reporter. It doesn't happen consistently: it seems to always happen at the first PeerConnection attempt on the page, while it seems to work after that.

Please let me know if there's anything I can do to help find the root cause of the issue.
Comment 1 youenn fablet 2019-10-21 10:59:46 PDT
Thanks Lorenzo, I'll fix this soon.
Comment 2 youenn fablet 2019-10-21 23:47:53 PDT
Created attachment 381514 [details]
Patch
Comment 3 WebKit Commit Bot 2019-10-22 12:03:52 PDT
Comment on attachment 381514 [details]
Patch

Clearing flags on attachment: 381514

Committed r251442: <https://trac.webkit.org/changeset/251442>
Comment 4 WebKit Commit Bot 2019-10-22 12:03:53 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2019-10-22 12:04:19 PDT
<rdar://problem/56509493>