<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15439">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: Make modify_local_offer2 tolerate previous failed SDP.<br><br>If a remote side is broken and sends an SDP that can not be<br>negotiated the call will be torn down but there is a window<br>where a second 183 Session Progress or 200 OK that is forked<br>can be received that also attempts to negotiate SDP. Since<br>the code marked the SDP negotiation as being done and complete<br>prior to this it assumes that there is an active local and remote<br>SDP which it can modify, while in fact there is not as the SDP<br>did not successfully negotiate. Since there is no local or remote<br>SDP a crash occurs.<br><br>This patch changes the pjmedia_sdp_neg_modify_local_offer2<br>function to no longer assume that a previous SDP negotiation<br>was successful.<br><br>ASTERISK-29196<br><br>Change-Id: I22de45916d3b05fdc2a67da92b3a38271ee5949e<br>---<br>A third-party/pjproject/patches/0080-fix-sdp-neg-modify-local-offer.patch<br>1 file changed, 33 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/39/15439/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/third-party/pjproject/patches/0080-fix-sdp-neg-modify-local-offer.patch b/third-party/pjproject/patches/0080-fix-sdp-neg-modify-local-offer.patch</span><br><span>new file mode 100644</span><br><span>index 0000000..c27a489</span><br><span>--- /dev/null</span><br><span>+++ b/third-party/pjproject/patches/0080-fix-sdp-neg-modify-local-offer.patch</span><br><span>@@ -0,0 +1,33 @@</span><br><span style="color: hsl(120, 100%, 40%);">+diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c</span><br><span style="color: hsl(120, 100%, 40%);">+index 3b85b4273..a14009662 100644</span><br><span style="color: hsl(120, 100%, 40%);">+--- a/pjmedia/src/pjmedia/sdp_neg.c</span><br><span>++++ b/pjmedia/src/pjmedia/sdp_neg.c</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -304,7 +304,6 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer2(</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ pjmedia_sdp_session *new_offer;</span><br><span style="color: hsl(120, 100%, 40%);">+ pjmedia_sdp_session *old_offer;</span><br><span style="color: hsl(120, 100%, 40%);">+- char media_used[PJMEDIA_MAX_SDP_MEDIA];</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned oi; /* old offer media index */</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_status_t status;</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+@@ -323,8 +322,19 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer2(</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Change state to STATE_LOCAL_OFFER */</span><br><span style="color: hsl(120, 100%, 40%);">+ neg->state = PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER;</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">++ /* When there is no active local SDP in state PJMEDIA_SDP_NEG_STATE_DONE,</span><br><span style="color: hsl(120, 100%, 40%);">++ * it means that the previous initial SDP nego must have been failed,</span><br><span style="color: hsl(120, 100%, 40%);">++ * so we'll just set the local SDP offer here.</span><br><span style="color: hsl(120, 100%, 40%);">++ */</span><br><span style="color: hsl(120, 100%, 40%);">++ if (!neg->active_local_sdp) {</span><br><span style="color: hsl(120, 100%, 40%);">++ neg->initial_sdp_tmp = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">++ neg->initial_sdp = pjmedia_sdp_session_clone(pool, local);</span><br><span style="color: hsl(120, 100%, 40%);">++ neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local);</span><br><span style="color: hsl(120, 100%, 40%);">++</span><br><span style="color: hsl(120, 100%, 40%);">++ return PJ_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">++ }</span><br><span style="color: hsl(120, 100%, 40%);">++</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Init vars */</span><br><span style="color: hsl(120, 100%, 40%);">+- pj_bzero(media_used, sizeof(media_used));</span><br><span style="color: hsl(120, 100%, 40%);">+ old_offer = neg->active_local_sdp;</span><br><span style="color: hsl(120, 100%, 40%);">+ new_offer = pjmedia_sdp_session_clone(pool, local);</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15439">change 15439</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15439"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13.38 </div>
<div style="display:none"> Gerrit-Change-Id: I22de45916d3b05fdc2a67da92b3a38271ee5949e </div>
<div style="display:none"> Gerrit-Change-Number: 15439 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>