RESOLVED FIXED 228636
softlink nw_parameters_allow_sharing_port_with_listener
https://bugs.webkit.org/show_bug.cgi?id=228636
Summary softlink nw_parameters_allow_sharing_port_with_listener
youenn fablet
Reported 2021-07-30 06:34:38 PDT
softlink nw_parameters_allow_sharing_port_with_listener
Attachments
Patch (3.32 KB, patch)
2021-07-30 06:37 PDT, youenn fablet
no flags
Patch for landing (4.71 KB, patch)
2021-07-30 09:37 PDT, youenn fablet
no flags
Patch for landing (4.95 KB, patch)
2021-07-30 09:39 PDT, youenn fablet
no flags
Rebasing (4.91 KB, patch)
2021-07-30 10:40 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2021-07-30 06:37:16 PDT
Darin Adler
Comment 2 2021-07-30 09:02:12 PDT
Comment on attachment 434619 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434619&action=review > Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:292 > + String portString; > + const char* portValue; > +#if HAVE(NWPARAMETERS_TRACKER_API) > + if (nw_parameters_allow_sharing_port_with_listenerPtr()) { > + nw_parameters_allow_sharing_port_with_listenerPtr()(parameters.get(), m_nwListener.get()); > + portString = String::number(m_address.port()); > + portValue = portString.utf8().data(); This code is wrong, and already was, and I am surprised it works. To keep around a pointer to the UTF-8 data we need a CString for the local variable, not a String. portString = String::number(m_address.port()).utf8(); portValue = portString.data(); There are also ways to write this that don’t allocate memory on the heap, using writeIntegerToBuffer, but the above should at least fix the dangerous lifetime bug.
youenn fablet
Comment 3 2021-07-30 09:31:56 PDT
Right, I'll fix this or move to nw_endpoint_create_host_with_numeric_port if possible
youenn fablet
Comment 4 2021-07-30 09:37:01 PDT
Created attachment 434636 [details] Patch for landing
youenn fablet
Comment 5 2021-07-30 09:39:57 PDT
Created attachment 434637 [details] Patch for landing
youenn fablet
Comment 6 2021-07-30 10:40:48 PDT
Created attachment 434646 [details] Rebasing
EWS
Comment 7 2021-07-30 11:08:28 PDT
Committed r280484 (240119@main): <https://commits.webkit.org/240119@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 434646 [details].
Radar WebKit Bug Importer
Comment 8 2021-07-30 11:09:19 PDT
Note You need to log in before you can comment on or make changes to this bug.