summaryrefslogtreecommitdiff
path: root/pjnath
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-07-14 12:49:36 +0000
committerBenny Prijono <bennylp@teluu.com>2012-07-14 12:49:36 +0000
commit5990539175ac160c5e3d927e1eeecdf5747dc89f (patch)
tree84a8267668908cb127de6da5a4e56e1a3e0eaac7 /pjnath
parent07075e93555b7504ace08c9693791f6cf13c4e62 (diff)
Fixed #1554: Assertion in ICE when STUN resolution yields a same address as one of the host candidate and there is only one host candidate exists (thanks Claudio De Angelis for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4205 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r--pjnath/src/pjnath/ice_strans.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index a19d9b80..b83c7514 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -503,6 +503,13 @@ static pj_status_t create_comp(pj_ice_strans *ice_st, unsigned comp_id)
add_update_turn(ice_st, comp);
}
+ /* It's possible that we end up without any candidates */
+ if (comp->cand_cnt == 0) {
+ PJ_LOG(4,(ice_st->obj_name,
+ "Error: no candidate is created due to settings"));
+ return PJ_EINVAL;
+ }
+
return PJ_SUCCESS;
}
@@ -1548,7 +1555,7 @@ static pj_bool_t stun_on_status(pj_stun_sock *stun_sock,
if (comp->default_cand > idx) {
--comp->default_cand;
} else if (comp->default_cand == idx) {
- comp->default_cand = !idx;
+ comp->default_cand = 0;
}
/* Remove srflx candidate */
@@ -1576,7 +1583,7 @@ static pj_bool_t stun_on_status(pj_stun_sock *stun_sock,
/* May not have cand, e.g. when error during init */
if (cand)
cand->status = status;
- if (!ice_st->cfg.stun.ignore_stun_error) {
+ if (!ice_st->cfg.stun.ignore_stun_error || comp->cand_cnt==1) {
sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT,
"STUN binding request failed", status);
} else {