<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19893">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bundled_pjproject: Prevent SEGV in pjsip_evsub_send_request<br><br>Check sub->pending_notify in evsub.c:on_tsx_state before<br>calling pjsip_evsub_send_request().<br><br>ASTERISK-30419<br><br>Change-Id: Id389f65bc88399fc538608af4508b09b439e1652<br>---<br>A third-party/pjproject/patches/0010-Make-sure-that-NOTIFY-tdata-is-set-before-sending-it.patch<br>1 file changed, 60 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/93/19893/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/third-party/pjproject/patches/0010-Make-sure-that-NOTIFY-tdata-is-set-before-sending-it.patch b/third-party/pjproject/patches/0010-Make-sure-that-NOTIFY-tdata-is-set-before-sending-it.patch</span><br><span>new file mode 100644</span><br><span>index 0000000..009060a</span><br><span>--- /dev/null</span><br><span>+++ b/third-party/pjproject/patches/0010-Make-sure-that-NOTIFY-tdata-is-set-before-sending-it.patch</span><br><span>@@ -0,0 +1,46 @@</span><br><span style="color: hsl(120, 100%, 40%);">+From ac685b30c17be461b2bf5b46a772ed9742b8e985 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(120, 100%, 40%);">+From: Riza Sulistyo <trengginas@users.noreply.github.com></span><br><span style="color: hsl(120, 100%, 40%);">+Date: Thu, 9 Feb 2023 13:19:23 +0700</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: [PATCH] Make sure that NOTIFY tdata is set before sending it.</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%);">+ pjsip/src/pjsip-simple/evsub.c | 9 ++++++---</span><br><span style="color: hsl(120, 100%, 40%);">+ 1 file changed, 6 insertions(+), 3 deletions(-)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c</span><br><span style="color: hsl(120, 100%, 40%);">+index da0a9b416..68c1d3951 100644</span><br><span style="color: hsl(120, 100%, 40%);">+--- a/pjsip/src/pjsip-simple/evsub.c</span><br><span>++++ b/pjsip/src/pjsip-simple/evsub.c</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -2216,23 +2216,26 @@ static void on_tsx_state_uas( pjsip_evsub *sub, pjsip_transaction *tsx,</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%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ sub->state = old_state;</span><br><span style="color: hsl(120, 100%, 40%);">+ sub->state_str = old_state_str;</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%);">+ /* Send the pending NOTIFY sent by app from inside</span><br><span style="color: hsl(120, 100%, 40%);">+ * on_rx_refresh() callback.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+- pj_assert(sub->pending_notify);</span><br><span style="color: hsl(120, 100%, 40%);">+- status = pjsip_evsub_send_request(sub, sub->pending_notify);</span><br><span style="color: hsl(120, 100%, 40%);">+- sub->pending_notify = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">++ //pj_assert(sub->pending_notify);</span><br><span style="color: hsl(120, 100%, 40%);">++ /* Make sure that pending_notify is set. */</span><br><span style="color: hsl(120, 100%, 40%);">++ if (sub->pending_notify) {</span><br><span style="color: hsl(120, 100%, 40%);">++ status = pjsip_evsub_send_request(sub, sub->pending_notify);</span><br><span style="color: hsl(120, 100%, 40%);">++ sub->pending_notify = NULL;</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%);">+ } else if (pjsip_method_cmp(&tsx->method, &pjsip_notify_method)==0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Handle authentication */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tsx->state == PJSIP_TSX_STATE_COMPLETED &&</span><br><span style="color: hsl(120, 100%, 40%);">+ (tsx->status_code==401 || tsx->status_code==407))</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_tx_data *tdata;</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_status_t status;</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_rx_data *rdata = event->body.tsx_state.src.rdata;</span><br><span style="color: hsl(120, 100%, 40%);">+-- </span><br><span style="color: hsl(120, 100%, 40%);">+2.39.1</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/+/19893">change 19893</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/+/19893"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Id389f65bc88399fc538608af4508b09b439e1652 </div>
<div style="display:none"> Gerrit-Change-Number: 19893 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>