[Asterisk-code-review] pjproject bundled: Prevent crash on bad outgoing header (asterisk[13])
George Joseph
asteriskteam at digium.com
Tue Jan 16 08:24:32 CST 2018
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/7975
Change subject: pjproject_bundled: Prevent crash on bad outgoing header
......................................................................
pjproject_bundled: Prevent crash on bad outgoing header
We still need to figure out how a bad header is getting into the
outgoing message but this patch to pjproject prevents attempting
to print that header and causing a crash.
For several users, this crash happens when sending 183 progress
messages.
ASTERISK-26832
Reported by: Ross Beer, Jan Rozhon
Change-Id: Ie5c5a921c890c843587763e7f33f987dfe66bd16
---
A third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch
1 file changed, 47 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/7975/1
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
new file mode 100644
index 0000000..c96292a
--- /dev/null
+++ b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch
@@ -0,0 +1,47 @@
+From cf6b662b8fe450ea7dc6eb5adb2b878971ce0d67 Mon Sep 17 00:00:00 2001
+From: George Joseph <gjoseph at digium.com>
+Date: Wed, 10 Jan 2018 08:48:32 -0700
+Subject: [PATCH] sip_msg: Prevent crash on header without vptr
+
+Occasionally a header with no vptr gets into the list of header. This
+causes a crash when printing them. We still need to figure out how
+the header got there but this patch at least prevents the crash by checking
+for a non-NULL vptr before attempting to call its print function.
+---
+ pjsip/src/pjsip/sip_msg.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c
+index 76d07b563..194b5ee01 100644
+--- a/pjsip/src/pjsip/sip_msg.c
++++ b/pjsip/src/pjsip/sip_msg.c
+@@ -26,6 +26,7 @@
+ #include <pj/string.h>
+ #include <pj/pool.h>
+ #include <pj/assert.h>
++#include <pj/log.h>
+ #include <pjlib-util/string.h>
+
+ PJ_DEF_DATA(const pjsip_method) pjsip_invite_method =
+@@ -469,6 +470,8 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,
+
+ *p++ = '\r';
+ *p++ = '\n';
++ } else {
++ PJ_LOG(1, ("sip_msg", "Header with no vptr encountered!! Current buffer: %.*s", (int)(p-buf), buf));
+ }
+ }
+
+@@ -576,6 +579,9 @@ PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )
+ PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)
+ {
+ pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;
++ if (!hdr->vptr) {
++ return 0;
++ }
+ return (*hdr->vptr->print_on)(hdr_ptr, buf, len);
+ }
+
+--
+2.14.3
+
--
To view, visit https://gerrit.asterisk.org/7975
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5c5a921c890c843587763e7f33f987dfe66bd16
Gerrit-Change-Number: 7975
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180116/dc3429a4/attachment.html>
More information about the asterisk-code-review
mailing list