<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7975">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjproject_bundled:  Prevent crash on bad outgoing header<br><br>We still need to figure out how a bad header is getting into the<br>outgoing message but this patch to pjproject prevents attempting<br>to print that header and causing a crash.<br><br>For several users, this crash happens when sending 183 progress<br>messages.<br><br>ASTERISK-26832<br>Reported by: Ross Beer, Jan Rozhon<br><br>Change-Id: Ie5c5a921c890c843587763e7f33f987dfe66bd16<br>---<br>A third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch<br>1 file changed, 47 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/75/7975/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch<br>new file mode 100644<br>index 0000000..c96292a<br>--- /dev/null<br>+++ b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch<br>@@ -0,0 +1,47 @@<br>+From cf6b662b8fe450ea7dc6eb5adb2b878971ce0d67 Mon Sep 17 00:00:00 2001<br>+From: George Joseph <gjoseph@digium.com><br>+Date: Wed, 10 Jan 2018 08:48:32 -0700<br>+Subject: [PATCH] sip_msg: Prevent crash on header without vptr<br>+<br>+Occasionally a header with no vptr gets into the list of header.  This<br>+causes a crash when printing them.  We still need to figure out how<br>+the header got there but this patch at least prevents the crash by checking<br>+for a non-NULL vptr before attempting to call its print function.<br>+---<br>+ pjsip/src/pjsip/sip_msg.c | 6 ++++++<br>+ 1 file changed, 6 insertions(+)<br>+<br>+diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c<br>+index 76d07b563..194b5ee01 100644<br>+--- a/pjsip/src/pjsip/sip_msg.c<br>++++ b/pjsip/src/pjsip/sip_msg.c<br>+@@ -26,6 +26,7 @@<br>+ #include <pj/string.h><br>+ #include <pj/pool.h><br>+ #include <pj/assert.h><br>++#include <pj/log.h><br>+ #include <pjlib-util/string.h><br>+ <br>+ PJ_DEF_DATA(const pjsip_method) pjsip_invite_method =<br>+@@ -469,6 +470,8 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,<br>+ <br>+           *p++ = '\r';<br>+         *p++ = '\n';<br>++    } else {<br>++        PJ_LOG(1, ("sip_msg", "Header with no vptr encountered!!  Current buffer: %.*s", (int)(p-buf), buf));<br>+        }<br>+     }<br>+ <br>+@@ -576,6 +579,9 @@ PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )<br>+ PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)<br>+ {<br>+     pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;<br>++    if (!hdr->vptr) {<br>++        return 0;<br>++    }<br>+     return (*hdr->vptr->print_on)(hdr_ptr, buf, len);<br>+ }<br>+ <br>+-- <br>+2.14.3<br>+<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7975">change 7975</a>. To unsubscribe, 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/7975"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie5c5a921c890c843587763e7f33f987dfe66bd16 </div>
<div style="display:none"> Gerrit-Change-Number: 7975 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>