[Home]

Summary:ASTERISK-27792: res_pjsip: Segfault when calling pjsip_hdr_print_on in sip_msg.c:581
Reporter:Ross Beer (rossbeer)Labels:pjsip
Date Opened:2018-04-06 04:23:05Date Closed:2018-04-06 05:09:48
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:13.20.0 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:CentOSAttachments:
Description:Since upgrading to pjproject 2.7.2 the patch that fixed issue ASTERISK-26832 was removed and the actual fix is not present in release 2.7.2

Fixed Code:

{noformat}
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);
}
{noformat}

2.7.2 Code:

{noformat}
PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)
{
   pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;
   return (*hdr->vptr->print_on)(hdr_ptr, buf, len);
}
{noformat}

The PJSIP team committed a change in revision 5727, however, this isn't in the 2.7.2 release.
Comments:By: Asterisk Team (asteriskteam) 2018-04-06 04:23:07.431-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Joshua C. Colp (jcolp) 2018-04-06 04:54:07.074-0500

The patch is still in the 13.20.0 release:

{noformat}
✔ jcolp@upsilon:~/development/asterisk/public [13.20.0| …1]> ls third-party/pjproject/patches/
0000-remove-third-party.patch                                    0040-183_without_to_tag.patch                            0071-sdp_fmtp_attr.patch  README
0000-set_apps_initial_log_level.patch                            0050-dont_terminate_session_early.patch                  asterisk_malloc_debug.c   user.mak
0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch  0060-sip_msg-Prevent-crash-on-header-without-vptr.patch  asterisk_malloc_debug.h
0030-sip_transport-Destroy-transports-not-in-hash.patch          0070-sdp_media_fmt.patch                                 config_site.h
{noformat}

By: Joshua C. Colp (jcolp) 2018-04-06 05:09:33.779-0500

It's also in the 13 branch itself:

{noformat}
✔ jcolp@upsilon:~/development/asterisk/public [13| …1]> ls third-party/pjproject/patches/
0000-remove-third-party.patch                                    0050-dont_terminate_session_early.patch                          asterisk_malloc_debug.c
0000-set_apps_initial_log_level.patch                            0060-sip_msg-Prevent-crash-on-header-without-vptr.patch          asterisk_malloc_debug.h
0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch  0070-os_core_unix-Set-mutex-NULL-in-atomic-destroy-and-ad.patch  config_site.h
0030-sip_transport-Destroy-transports-not-in-hash.patch          0080-timer-Clean-up-usage-of-timer-heap.patch                    README
0040-183_without_to_tag.patch                                    0090-sip_transaction-In-tsx_timer_callback-check-if-tsx-i.patch  user.mak
{noformat}

And gets applied as expected during the build process when bundled is enabled.