<p></p>

<h3>Description</h3>
<p>I get SIGSEGV in the start-up time with the wrong kamailio config.<br>
To get a backtrace, I set up gdb:</p>
<pre><code>gdb --args /home/devel/build_dir/build/sbin/kamailio -m 8 -n 1 -w . -f /tmp/kamailio.cfg
(gdb) start
(gdb) c
</code></pre>
<p>Then I see the error and the gdb output (attached below).</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>Pass to <code>ds_select_domain</code> non-constant value, e.g.</p>
<pre><code>$avp(num) = 13;
if (!ds_select_domain( 101, 4, $avp(num) )) {
  return 1;
}
</code></pre>
<h4>Debugging Data</h4>
<pre><code>Program received signal SIGSEGV, Segmentation fault.
0x00000000006a1daf in rve_destroy (rve=0x6f6c5f7265766f6c) at core/rvalue.c:147
147                     if (rve->op==RVE_RVAL_OP){
Missing separate debuginfos, use: debuginfo-install audit-libs-2.8.5-4.el7.x86_64 bzip2-libs-1.0.6-13.el7.x86_64 elfutils-libelf-0.176-4.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-46.el7.x86_64 libacl-2.2.51-15.el7.x86_64 libattr-2.4.46-13.el7.x86_64 libcap-2.22-11.el7.x86_64 libcap-ng-0.7.5-4.el7.x86_64 libcom_err-1.42.9-17.el7.x86_64 libdb-5.3.21-25.el7.x86_64 libgcc-4.8.5-39.el7.x86_64 libselinux-2.5-15.el7.x86_64 libstdc++-4.8.5-39.el7.x86_64 lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64 lua-5.1.4-15.el7.x86_64 net-snmp-agent-libs-5.7.2-48.el7_8.1.x86_64 net-snmp-libs-5.7.2-48.el7_8.1.x86_64 nspr-4.21.0-1.el7.x86_64 nss-3.44.0-7.el7_7.x86_64 nss-softokn-freebl-3.44.0-8.el7_7.x86_64 nss-util-3.44.0-4.el7_7.x86_64 openssl-libs-1.0.2k-19.el7.x86_64 pcre-8.32-17.el7.x86_64 perl-libs-5.16.3-295.el7.x86_64 popt-1.13-16.el7.x86_64 rpm-libs-4.11.3-43.el7.x86_64 tcp_wrappers-libs-7.6-77.el7.x86_64 xz-libs-5.2.2-1.el7.x86_64 zlib-1.2.7-18.el7.x86_64
(gdb) bt
#0  0x00000000006a1daf in rve_destroy (rve=0x6f6c5f7265766f6c) at core/rvalue.c:147
#1  0x00000000006a266e in rve_destroy (rve=0x7ffff6c77f08) at core/rvalue.c:168
#2  0x00000000007d2884 in free_mod_func_action (a=0x7ffff6c76658) at core/cfg.y:4047
#3  0x00000000007ce97f in yyparse () at core/cfg.y:3459
#4  0x000000000042f396 in main (argc=9, argv=0x7fffffffe448) at main.c:2320
(gdb) p rve
$1 = (struct rval_expr *) 0x6f6c5f7265766f6c
(gdb) p rve->op
Cannot access memory at address 0x6f6c5f7265766f6c
(gdb) 
</code></pre>
<h4>Log Messages</h4>

<pre><code> 0(425) CRITICAL: <core> [core/cfg.y:3589]: yyerror_at(): parse error in config file /tmp/kamailio.cfg, line 653, column 58-66: function ds_select_domain: parameter 3 is not constant
</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>version: kamailio 5.4.3 (x86_64/linux) 430602
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 430602 
compiled on 17:40:07 Jan 29 2021 with gcc 4.8.5
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<pre><code>(paste your output here)
</code></pre>

<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/2630">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZMXCUXZ32TWDQOAYRDS6FGGRANCNFSM4XLFOEWQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZPZRLGUVI5KDNMAB3TS6FGGRA5CNFSM4XLFOEW2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4L7V3Q4Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2630",
"url": "https://github.com/kamailio/kamailio/issues/2630",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>