[DTrace-devel] [PATCH 5/5] print: initialize dv_last_depth when print()ing arrays

Eugene Loh eugene.loh at oracle.com
Mon Mar 4 22:16:19 UTC 2024


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 3/4/24 17:03, Nick Alcock via DTrace-devel wrote:
> Much like ++ / -- earlier, print()ing arrays initializes a second copy of a
> relevant structure (in this case, dt_visit_arg) but fails to initialize all
> its members, leading to (theoretical) wrong-looking output as nonsense off
> the stack is interpreted as a nesting depth.
>
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>   libdtrace/dt_printf.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/libdtrace/dt_printf.c b/libdtrace/dt_printf.c
> index e844dc1bd18fe..1f52abb14abec 100644
> --- a/libdtrace/dt_printf.c
> +++ b/libdtrace/dt_printf.c
> @@ -2198,6 +2198,7 @@ doprint:
>   		dva2.dv_data = dva->dv_data;
>   		dva2.dv_startindent = dva->dv_startindent;
>   		dva2.dv_size = dva->dv_size;
> +		dva2.dv_last_depth = dva->dv_last_depth;
>   		if (ctf_type_encoding(dva->dv_ctfp, a.ctr_contents, &e) < 0) {
>   			dt_dprintf("error retrieving type encoding for array contents in [%ld]: %s\n",
>   				   a.ctr_contents,



More information about the DTrace-devel mailing list