Summary: | softlink nw_parameters_allow_sharing_port_with_listener | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | youenn fablet <youennf> | ||||||||||
Component: | WebRTC | Assignee: | youenn fablet <youennf> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | darin, eric.carlson, ews-watchlist, webkit-bug-importer, youennf | ||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||
Version: | WebKit Nightly Build | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Attachments: |
|
Description
youenn fablet
2021-07-30 06:34:38 PDT
Created attachment 434619 [details]
Patch
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. Right, I'll fix this or move to nw_endpoint_create_host_with_numeric_port if possible Created attachment 434636 [details]
Patch for landing
Created attachment 434637 [details]
Patch for landing
Created attachment 434646 [details]
Rebasing
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]. |