Skip to content

Commit

Permalink
Use rust::String::lossy for stringification to avoid crashing due to …
Browse files Browse the repository at this point in the history
…non-utf8 content (#485)
  • Loading branch information
mgsloan authored Nov 13, 2024
1 parent 80a36c2 commit ee5076b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webrtc-sys/src/jsep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<webrtc::IceCandidateInterface> IceCandidate::release() {
Expand Down Expand Up @@ -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> SessionDescription::clone() const {
Expand Down

0 comments on commit ee5076b

Please sign in to comment.