From ee5076baf83bfe9e8100fb7c78757db746ee4c70 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Tue, 12 Nov 2024 19:51:53 -0700 Subject: [PATCH] Use rust::String::lossy for stringification to avoid crashing due to non-utf8 content (#485) --- webrtc-sys/src/jsep.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc-sys/src/jsep.cpp b/webrtc-sys/src/jsep.cpp index 0dcc9f0fb..a1283229e 100644 --- a/webrtc-sys/src/jsep.cpp +++ b/webrtc-sys/src/jsep.cpp @@ -53,7 +53,7 @@ rust::String IceCandidate::candidate() const { rust::String IceCandidate::stringify() const { std::string str; ice_candidate_->ToString(&str); - return rust::String{str}; + return rust::String::lossy(str); } std::unique_ptr IceCandidate::release() { @@ -85,7 +85,7 @@ SdpType SessionDescription::sdp_type() const { rust::String SessionDescription::stringify() const { std::string str; session_description_->ToString(&str); - return rust::String{str}; + return rust::String::lossy(str); } std::unique_ptr SessionDescription::clone() const {