mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 03:02:04 +00:00
This patch makes the usual necessary changes when upgrading to a new version pjproject. For instance, version number bump, patches removed from third-party, new *.md5 file added, etc.. This patch also includes a change to the Asterisk pjproject Makefile to explicitly create the 'source/pjsip-apps/lib' directory. This directory is no longer there by default so needs to be added so the Asterisk malloc debug can be built. This patch also includes some minor changes to Asterisk that were a result of the upgrade. Specifically, there was a backward incompatibility change made in 2.10 that modified the "expires header" variable field from a signed to an unsigned value. This potentially effects comparison. Namely, those check for a value less than zero. This patch modified a few locations in the Asterisk code that may have been affected. Lastly, this patch adds a new macro PJSIP_MINVERSION that can be used to check a minimum version of pjproject at compile time. ASTERISK-28899 #close Change-Id: Iec8821c6cbbc08c369d0e3cd2f14e691b41d0c81
40 lines
1.6 KiB
Diff
40 lines
1.6 KiB
Diff
commit c3c1bf45cae2a35003aa16c267d59f97027f9c5e
|
|
Author: Kevin Harwell <kharwell@digium.com>
|
|
Date: Thu Jun 11 11:11:13 2020 -0500
|
|
|
|
sip_inv - fix invite session ref count crash
|
|
|
|
Ensure the session's ref count is only decremented under proper conditons.
|
|
|
|
For more details see the following issue report:
|
|
https://github.com/pjsip/pjproject/issues/2443
|
|
|
|
Patch supplied by sauwming
|
|
|
|
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
|
|
index ca225015b..7c11b1c8e 100644
|
|
--- a/pjsip/src/pjsip-ua/sip_inv.c
|
|
+++ b/pjsip/src/pjsip-ua/sip_inv.c
|
|
@@ -323,9 +323,19 @@ static void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state,
|
|
(*mod_inv.cb.on_state_changed)(inv, e);
|
|
pjsip_inv_dec_ref(inv);
|
|
|
|
- /* Only decrement when previous state is not already DISCONNECTED */
|
|
+ /* The above callback may change the state, so we need to be careful here
|
|
+ * and only decrement inv under the following conditions:
|
|
+ * 1. If the state parameter is DISCONNECTED, and previous state is not
|
|
+ * already DISCONNECTED.
|
|
+ * This is to make sure that dec_ref() is not called more than once.
|
|
+ * 2. If current state is PJSIP_INV_STATE_DISCONNECTED.
|
|
+ * This is to make sure that dec_ref() is not called if user restarts
|
|
+ * inv within the callback. Note that this check must be last since
|
|
+ * inv may have already been destroyed.
|
|
+ */
|
|
if (state == PJSIP_INV_STATE_DISCONNECTED &&
|
|
- prev_state != PJSIP_INV_STATE_DISCONNECTED)
|
|
+ prev_state != PJSIP_INV_STATE_DISCONNECTED &&
|
|
+ inv->state == PJSIP_INV_STATE_DISCONNECTED)
|
|
{
|
|
pjsip_inv_dec_ref(inv);
|
|
}
|