[Asterisk-code-review] core: Fix NPE in ast_manager_build_channel_state_string when snapshot... (asterisk[16])

Robert Sutton asteriskteam at digium.com
Sun May 17 06:12:00 CDT 2020


Robert Sutton has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/14144 )

Change subject: core: Fix NPE in ast_manager_build_channel_state_string when snapshot is NULL
......................................................................


Patch Set 3:

I've acquired a couple identical backtraces from 2 systems

Running asterisk 16.10

[May 15 17:16:11] ERROR[33]:   Got 15 backtrace records
# 0: [0x5db45d] asterisk utils.c:2404 __ast_assert_failed()
# 1: [0x51d3fd] asterisk manager_channels.c:498 ast_manager_build_channel_state_string_prefix()
# 2: [0x51d818] asterisk manager_channels.c:570 ast_manager_build_channel_state_string()
# 3: [0x7feccd91dff5] res_agi.so res_agi.c:1427 agi_channel_to_ami()
# 4: [0x7feccd91e107] res_agi.so res_agi.c:1443 agi_exec_start_to_ami()
# 5: [0x5b414b] asterisk stasis_message.c:226 stasis_message_to_ami()
# 6: [0x628343] asterisk manager.c:1848 manager_default_msg_cb()
# 7: [0x5b48a6] asterisk stasis_message_router.c:202 router_dispatch()
# 8: [0x59fccd] asterisk stasis.c:780 subscription_invoke()
# 9: [0x5a0f7f] asterisk stasis.c:1260 dispatch_exec_async()
#10: [0x5c5720] asterisk taskprocessor.c:1235 ast_taskprocessor_execute()
#11: [0x5c2755] asterisk taskprocessor.c:201 default_tps_processing_function()
#12: [0x5d83b7] asterisk utils.c:1249 dummy_start()
#13: [0x7fed1a66a6ba] libpthread.so.0 :0 __pthread_get_minstack()
#14: [0x7fed198ff41d] libc.so.6 :0 clone()

with this patch applied

diff --git a/main/manager_channels.c b/main/manager_channels.c
index c964033..25b5c65 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -493,6 +493,11 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
        char *connected_name;
        int res;
 
+       if (!snapshot) {
+               __ast_assert_failed(0, "snapshot != NULL in ast_manager_build_channel_state_string_prefix",__FILE__,__LINE__,__PRETTY_FUNCTION__);
+               return NULL;
+       }
+
        if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {
                return NULL;
        }


-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14144
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I3393e4d521ab6c4551b5434d013a5941706c28de
Gerrit-Change-Number: 14144
Gerrit-PatchSet: 3
Gerrit-Owner: Robert Sutton <rsutton at noojee.com.au>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-CC: Corey Farrell <git at cfware.com>
Gerrit-Comment-Date: Sun, 17 May 2020 11:12:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200517/b055670c/attachment.html>


More information about the asterisk-code-review mailing list