<h3>Description</h3>
<p>Kamailio is segfaulting after activating pubruri_caller_dlg_var and pubruri_callee_dlg_var from pua_dialoginfo.</p>
<p>modparam("pua_dialoginfo", "use_pubruri_avps", 1)<br>
//modparam("pua_dialoginfo", "pubruri_caller_avp", "$avp(s:pubruris_caller)")<br>
//modparam("pua_dialoginfo", "pubruri_callee_avp", "$avp(s:pubruris_callee)")<br>
modparam("pua_dialoginfo", "pubruri_caller_dlg_var", "pubruri_caller")<br>
modparam("pua_dialoginfo", "pubruri_callee_dlg_var", "pubruri_callee")</p>
<p>When i comment the corresponding lines and switch back to the regular avps Kamailio runs without problems.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>In my setup it seems to be sufficient to just set the module parameters to provoke the segfault.<br>
I dont have to wait for any SIP-Traffic or accessing the dlg_vars. Kamailio segfaults while starting.</p>
<h4>Debugging Data</h4>

<pre><code>[root@kamroute ~]# gdb /usr/sbin/kamailio /core.6547
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/kamailio...Reading symbols from /usr/lib/debug/usr/sbin/kamailio.debug...done.
done.
[New LWP 6547]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio_'.
Program terminated with signal 11, Segmentation fault.
#0  __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:31
31              movdqu  (%rdi), %xmm1
(gdb) bt full
#0  __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:31
No locals.
#1  0x00007fc7c61786c4 in mod_init () at pua_dialoginfo.c:692
        bind_pua = 0x7fc7c6396b88 <bind_pua>
        s = {s = 0x0, len = -969002120}
        avp_spec = {type = 397561584, getf = 0x7fc7ce3b8827 <__fprintf+135>, setf = 0x3, pvp = {pvn = {type = 48, nfree = 0x7ffd17b24e80, u = {isname = {type = 397561264, name = {n = 7976200, s = {s = 0x79b508 "DEBUG", 
                      len = 397562576}, re = 0x79b508}}, dname = 0x7ffd17b24db0}}, pvi = {type = 0, u = {ival = 6547, dval = 0x1993}}}, trans = 0x79b508}
        __FUNCTION__ = "mod_init"
#2  0x00000000005661e2 in init_mod (m=0x7fc7cdbd3ac0) at core/sr_module.c:966
        __FUNCTION__ = "init_mod"
#3  0x0000000000565f1e in init_mod (m=0x7fc7cdbd3e50) at core/sr_module.c:963
        __FUNCTION__ = "init_mod"
#4  0x0000000000566519 in init_modules () at core/sr_module.c:995
        t = 0x20000003e4
        i = 994
        __FUNCTION__ = "init_modules"
#5  0x00000000004293e1 in main (argc=13, argv=0x7ffd17b252d8) at main.c:2584
        cfg_stream = 0x254c010
        c = -1
        r = 397562176
        tmp = 0x7ffd17b256e0 ""
        tmp_len = 0
        port = 0
        proto = 0
        options = 0x737a20 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
        ret = -1
        seed = 286186509
        rfd = 4
        debug_save = 0
        debug_flag = 0
        dont_fork_cnt = 0
        n_lst = 0x0
        p = 0x0
        st = {st_dev = 18, st_ino = 37027, st_nlink = 2, st_mode = 16832, st_uid = 996, st_gid = 2, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1507876455, tv_nsec = 469604021}, 
          st_mtim = {tv_sec = 1507878072, tv_nsec = 553083864}, st_ctim = {tv_sec = 1507878072, tv_nsec = 553083864}, __unused = {0, 0, 0}}
        __FUNCTION__ = "main"
(gdb) info locals
cfg_stream = 0x254c010
c = -1
r = 397562176
tmp = 0x7ffd17b256e0 ""
tmp_len = 0
port = 0
proto = 0
options = 0x737a20 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
ret = -1
seed = 286186509
rfd = 4
debug_save = 0
debug_flag = 0
dont_fork_cnt = 0
n_lst = 0x0
p = 0x0
st = {st_dev = 18, st_ino = 37027, st_nlink = 2, st_mode = 16832, st_uid = 996, st_gid = 2, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1507876455, tv_nsec = 469604021}, st_mtim = {
    tv_sec = 1507878072, tv_nsec = 553083864}, st_ctim = {tv_sec = 1507878072, tv_nsec = 553083864}, __unused = {0, 0, 0}}
__FUNCTION__ = "main"
(gdb) list
26              mov     %edi, %ecx
27              and     $0x3f, %ecx
28              pxor    %xmm0, %xmm0
29              cmp     $0x30, %ecx
30              ja      L(next)
31              movdqu  (%rdi), %xmm1
32              pcmpeqb %xmm1, %xmm0
33              pmovmskb %xmm0, %edx
34              test    %edx, %edx
35              jnz     L(exit_less16)
(gdb)
</code></pre>
<h4>Log Messages</h4>

<p>Nothing which seems to be interesting. Kamailios last words are:</p>
<pre><code> 0(7450) DEBUG: <core> [core/sr_module.c:965]: init_mod(): pua_dialoginfo
 0(7450) DEBUG: <core> [core/sr_module.c:694]: find_mod_export_record(): find_export_record: found <bind_pua> in module pua [/usr/lib64/kamailio/modules/pua.so]
 0(7450) DEBUG: <core> [core/sr_module.c:694]: find_mod_export_record(): find_export_record: found <load_dlg> in module dialog [/usr/lib64/kamailio/modules/dialog.so]
 0(7448) ERROR: <core> [core/daemonize.c:303]: daemonize(): Main process exited before writing to pipe
</code></pre>
<h4>SIP Traffic</h4>

<pre><code>no SIP Traffic needed
</code></pre>
<h3>Possible Solutions</h3>

<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>[root@kamroute ~]# kamailio -v
version: kamailio 5.0.3 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled on 12:31:32 Sep 20 2017 with gcc 4.8.2

[root@kamroute ~]# rpm -qa|grep kamail
kamailio-presence-5.0.3-10.el7.x86_64
kamailio-outbound-5.0.3-10.el7.x86_64
kamailio-debuginfo-5.0.3-10.el7.x86_64
kamailio-5.0.3-10.el7.x86_64
kamailio-ims-5.0.3-10.el7.x86_64
kamailio-xmpp-5.0.3-10.el7.x86_64
kamailio-mysql-5.0.3-10.el7.x86_64
[root@kamroute ~]#
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<p>Up2date RHEL7.</p>
<pre><code>[root@kamroute ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@kamroute ~]# uname -a
Linux kamroute.intranet.mydomain.de 3.10.0-514.26.1.el7.x86_64 #1 SMP Tue Jun 20 01:16:02 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@kamroute ~]# 
</code></pre>
<p>If you need any further information just let me know!</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1271">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36Ze_yEOmkYAGcy-NV84NvhrJraOWRks5srw3zgaJpZM4P4ESC">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZTeKcnXM2encPqNKB90CXWeULOt4ks5srw3zgaJpZM4P4ESC.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/1271"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"pua_dialoginfo: segfault after setting pubruri_caller_dlg_var/pubruri_callee_dlg_var (#1271)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1271"}}}</script>