From 9ef35e8f778d05347aaaa291d54e3154f5e58a8c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 15 Mar 2015 17:16:02 +0100 Subject: [PATCH] fix crash when receiving no SDP in 200 OK and ICE is enabled --- coreapi/callbacks.c | 11 ++++++----- mediastreamer2 | 2 +- oRTP | 2 +- tester/call_tester.c | 19 ++++++++++++++----- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 1c41d70cc..df6170c77 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -465,23 +465,24 @@ static void call_ringing(SalOp *h){ static void call_accepted(SalOp *op){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); - SalMediaDescription *md; + SalMediaDescription *md, *rmd; bool_t update_state=TRUE; if (call==NULL){ ms_warning("No call to accept."); return ; } + rmd=sal_call_get_remote_media_description(op); /*set privacy*/ call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op); /* Handle remote ICE attributes if any. */ - if (call->ice_session != NULL) { - linphone_call_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(op)); + if (call->ice_session != NULL && rmd) { + linphone_call_update_ice_from_remote_media_description(call, rmd); } #ifdef BUILD_UPNP - if (call->upnp_session != NULL) { - linphone_core_update_upnp_from_remote_media_description(call, sal_call_get_remote_media_description(op)); + if (call->upnp_session != NULL && rmd) { + linphone_core_update_upnp_from_remote_media_description(call, rmd); } #endif //BUILD_UPNP diff --git a/mediastreamer2 b/mediastreamer2 index 2be165a12..8e97e29d6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2be165a129a174a6b9a51574aee85f90d4f38084 +Subproject commit 8e97e29d6ed8baa66ff95c74181a215e522c292d diff --git a/oRTP b/oRTP index 3b0892f87..19ed314d5 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 3b0892f87fecbd7d3e2b34b381527ab1d7e59a59 +Subproject commit 19ed314d52d4061a21daa4805aef9459ad31640c diff --git a/tester/call_tester.c b/tester/call_tester.c index f431ff8cb..e5ca8a6bd 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -3245,7 +3245,7 @@ static void call_with_paused_no_sdp_on_resume() { } } -static void early_media_without_sdp_in_200_base( bool_t use_video ){ +static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice ){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc"); MSList* lcs = NULL; @@ -3258,6 +3258,10 @@ static void early_media_without_sdp_in_200_base( bool_t use_video ){ lcs = ms_list_append(lcs,marie->lc); lcs = ms_list_append(lcs,pauline->lc); + if (use_ice){ + linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); + linphone_core_set_stun_server(marie->lc, "stun.linphone.org"); + } /* Marie calls Pauline, and after the call has rung, transitions to an early_media session */ @@ -3318,11 +3322,15 @@ static void early_media_without_sdp_in_200_base( bool_t use_video ){ } static void call_with_early_media_and_no_sdp_in_200_with_video(){ - early_media_without_sdp_in_200_base(TRUE); + early_media_without_sdp_in_200_base(TRUE, FALSE); } static void call_with_early_media_and_no_sdp_in_200(){ - early_media_without_sdp_in_200_base(FALSE); + early_media_without_sdp_in_200_base(FALSE, FALSE); +} + +static void call_with_early_media_ice_and_no_sdp_in_200(){ + early_media_without_sdp_in_200_base(FALSE, TRUE); } static void call_with_generic_cn(void) { @@ -3551,8 +3559,9 @@ test_t call_tests[] = { { "Call with in-dialog codec change", call_with_in_dialog_codec_change }, { "Call with in-dialog codec change no sdp", call_with_in_dialog_codec_change_no_sdp }, { "Call with pause no SDP on resume", call_with_paused_no_sdp_on_resume }, - { "Call with early media and no SDP on 200 Ok", call_with_early_media_and_no_sdp_in_200 }, - { "Call with early media and no SDP on 200 Ok with video", call_with_early_media_and_no_sdp_in_200_with_video }, + { "Call with early media and no SDP in 200 Ok", call_with_early_media_and_no_sdp_in_200 }, + { "Call with early media and no SDP in 200 Ok with video", call_with_early_media_and_no_sdp_in_200_with_video }, + { "Call with ICE and no SDP in 200 OK", call_with_early_media_ice_and_no_sdp_in_200}, { "Call with custom supported tags", call_with_custom_supported_tags }, { "Call log from taken from asserted id",call_log_from_taken_from_p_asserted_id}, { "Incoming INVITE with invalid SDP",incoming_invite_with_invalid_sdp},