diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c index 3a9f8d4da..86ee69087 100644 --- a/libdtrace/dt_cg.c +++ b/libdtrace/dt_cg.c @@ -4642,13 +4642,20 @@ dt_cg_subr_arg_to_tstring(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp, { dt_ident_t *idp; dt_node_t *arg = dnp->dn_args; + dt_idsig_t *isp; + dt_node_t *argtype; TRACE_REGSET(" subr-arg_to_tstring:Begin"); + assert(dnp->dn_ident && dnp->dn_ident); + isp = dnp->dn_ident->di_data; + assert(isp && isp->dis_args); + argtype = &isp->dis_args[0]; + /* handle the one "input value" */ /* (its type matters only as to whether we check it is null */ dt_cg_node(arg, dlp, drp); - if (dt_node_is_pointer(arg) || dt_node_is_string(arg)) + if (dt_node_is_pointer(argtype) || dt_node_is_string(argtype)) dt_cg_check_ptr_arg(dlp, drp, arg, NULL); /* allocate the temporary string */ diff --git a/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6badaddr.d b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.d similarity index 100% rename from test/unittest/funcs/inet_ntoa6/err.inet_ntoa6badaddr.d rename to test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.d diff --git a/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.r b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.r new file mode 100644 index 000000000..187543b63 --- /dev/null +++ b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.r @@ -0,0 +1,3 @@ + +-- @@stderr -- +dtrace: error on enabled probe ID 3 (ID 1: dtrace:::BEGIN): invalid address ({ptr}) in action #1 at BPF pc NNN diff --git a/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.d b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.d new file mode 100644 index 000000000..f5881d403 --- /dev/null +++ b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.d @@ -0,0 +1,19 @@ +/* + * Oracle Linux DTrace. + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Licensed under the Universal Permissive License v 1.0 as shown at + * http://oss.oracle.com/licenses/upl. + */ + +#pragma D option quiet + +BEGIN +{ + inet_ntoa6(NULL); + exit(0); +} + +ERROR +{ + exit(1); +} diff --git a/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.r b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.r new file mode 100644 index 000000000..187543b63 --- /dev/null +++ b/test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.r @@ -0,0 +1,3 @@ + +-- @@stderr -- +dtrace: error on enabled probe ID 3 (ID 1: dtrace:::BEGIN): invalid address ({ptr}) in action #1 at BPF pc NNN