[Home]

Summary:ASTERISK-29097: res_pjsip_config_wizard: Crash when freeing string when failing to add extension
Reporter:Vieri (vieridipaola)Labels:webrtc
Date Opened:2020-09-25 07:07:17Date Closed:2020-10-02 10:08:46
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_config_wizard
Versions:16.13.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Gentoo Linux - official asterisk ebuild with "debug" use flagAttachments:( 0) backtrace.txt
( 1) bt.txt
( 2) btfull.txt
Description:Asterisk exits each time I issue:

asterisk -rx "module reload res_pjsip.so"

Tried pjproject v. 2.9 and 2.10.

Asterisk exits with:

Reloading module 'res_pjsip.so' (Basic SIP resource)
double free or corruption (fasttop)
Aborted
Comments:By: Asterisk Team (asteriskteam) 2020-09-25 07:07:17.707-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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Joshua C. Colp (jcolp) 2020-09-25 07:14:27.347-0500

What is an example configuration that exhibits this issue, and what steps are required to reproduce it?

By: Vieri (vieridipaola) 2020-09-26 16:31:12.392-0500

Finally got debug info without optimization.

By: Vieri (vieridipaola) 2020-09-26 16:35:00.330-0500

Full trace.

By: Vieri (vieridipaola) 2020-09-26 16:51:33.768-0500

It seems that I can reproduce the issue by simply adding this to extensions.conf:

[default]
exten => 1001,1,NoOp()

That leads to the message "Unable to register extension '1001' priority 1 in 'default', already in use" and the crash.

I have no other reference to "1001" in my asterisk conf dir and subdirs.

Changing 1001 to 1002 avoids the crash.


By: Vieri (vieridipaola) 2020-09-26 17:09:19.581-0500

My previous observation is true but not enough.

To reproduce the problem you also need:

pjsip_wizard.conf
{noformat}
[webrtc_defaults](!)
type = wizard
transport = transport-wss
accepts_registrations = yes
sends_registrations = no
accepts_auth = yes
sends_auth = no
has_hint = yes
hint_context = default
hint_application = Gosub(default,${EXTEN},1(${HINT}))
endpoint/context = default
endpoint/dtls_auto_generate_cert = yes
endpoint/webrtc = yes
endpoint/allow_subscribe = yes
endpoint/allow = !all,alaw,ulaw,opus,gsm,g722,vp8,h264
endpoint/direct_media = yes
; endpoint/max_audio_streams = 10
; endpoint/max_video_streams = 10
endpoint/message_context=textmessages
endpoint/force_rport = yes
endpoint/disable_direct_media_on_nat = yes
endpoint/direct_media_method = invite
; endpoint/ice_support = yes
endpoint/moh_suggest = default
endpoint/send_rpid = yes
endpoint/rewrite_contact = yes
endpoint/send_pai = yes
endpoint/allow_transfer = yes
endpoint/trust_id_inbound = yes
endpoint/device_state_busy_at = 1
endpoint/trust_id_outbound = yes
endpoint/send_diversion = yes
endpoint/rtp_symmetric = yes
aor/qualify_frequency = 30
aor/authenticate_qualify = no
aor/max_contacts = 1
aor/remove_existing = yes
aor/minimum_expiration = 30
aor/support_path = yes

[1001](webrtc_defaults)
hint_exten = 1001
inbound_auth/username = 1001
inbound_auth/password = whatever
endpoint/callerid = Guest 1 <1001>
aor/max_contacts = 200
{noformat}
The line 'hint_exten = 1001' is the one producing the crash.

Removing it solves the issue.

Doing the same for 4000, 5000, etc., instead of 1001 does not produce a crash.


By: Friendly Automation (friendly-automation) 2020-10-02 10:08:47.385-0500

Change 15021 merged by Friendly Automation:
pbx.c: On error, ast_add_extension2_lockopt should always free 'data'

[https://gerrit.asterisk.org/c/asterisk/+/15021|https://gerrit.asterisk.org/c/asterisk/+/15021]

By: Friendly Automation (friendly-automation) 2020-10-02 10:12:31.506-0500

Change 15022 merged by Friendly Automation:
pbx.c: On error, ast_add_extension2_lockopt should always free 'data'

[https://gerrit.asterisk.org/c/asterisk/+/15022|https://gerrit.asterisk.org/c/asterisk/+/15022]

By: Friendly Automation (friendly-automation) 2020-10-02 10:13:11.434-0500

Change 15013 merged by Friendly Automation:
pbx.c: On error, ast_add_extension2_lockopt should always free 'data'

[https://gerrit.asterisk.org/c/asterisk/+/15013|https://gerrit.asterisk.org/c/asterisk/+/15013]

By: Friendly Automation (friendly-automation) 2020-10-02 12:57:42.287-0500

Change 15011 merged by George Joseph:
pbx.c: On error, ast_add_extension2_lockopt should always free 'data'

[https://gerrit.asterisk.org/c/asterisk/+/15011|https://gerrit.asterisk.org/c/asterisk/+/15011]

By: Friendly Automation (friendly-automation) 2020-10-02 12:58:54.564-0500

Change 15012 merged by George Joseph:
pbx.c: On error, ast_add_extension2_lockopt should always free 'data'

[https://gerrit.asterisk.org/c/asterisk/+/15012|https://gerrit.asterisk.org/c/asterisk/+/15012]