iOS Crash on SetRemote/LocalDescription

Skip to first unread message

Minhyuk Kim

Sep 4, 2021, 8:36:17 AMSep 4
to discuss-webrtc
In the latest release of iOS SDK, the SDK crashs with `exc_bad_access` when setting remote/local description with invalid session description. 
This is caused by `sdp.nativeDescription->Clone()` in
_peerConnection->SetRemoteDescription(sdp.nativeDescription->Clone(), observer);

When an invalid session description is provided, the return value of `sdp.nativeDescription` is nullptr, and trying to call `Clone()` on it results in a bad access crash. 

This can be fixed by changing the code to something like: 
_peerConnection->SetRemoteDescription(sdp.nativeDescription ? sdp.nativeDescription->Clone() : nullptr, observer);

I found this out during stress testing. While the session description should be valid at all times, I think having it safely disregarded is better than simply crashing the app. 

It's my first time posting here; is there a good way to go about suggesting a fix for this?

Philipp Hancke

Sep 4, 2021, 8:47:52 AMSep 4


You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages