Problem using %V in snprintf

Raphael Mazelier ngx_ut0mt8 at
Tue Jun 5 19:41:53 UTC 2018

Hello Ngx devs,

I'm unsure if it the good ml for posting some question about coding 
nginx module. Anyway here it is.

So I'm hacking a bit the nginx-rtmp-module (you could see my fork here : )

A detail puzzle me.

"wdv_data" is config directive filled with base64 text:

  { ngx_string("dash_wdv_data"), 
       offsetof(ngx_rtmp_dash_app_conf_t, wdv_data),
       NULL },

When I'm trying to use as it, and to write it using :

p = buffer;
p = ngx_slprintf(p, last, "- %V -", dacf->wdv_data);
n = ngx_write_fd(fd, buffer, p - buffer);

I got a segfault in ngx_vslprintf.
#0  0x0000000000418430 in ngx_vslprintf (buf=0xd3cf2c <buffer.26926+588> 
" <Period start=\"PT0S\" id=\"dash\">\n", last=0xe3cce0 
<buffer_depth.26929> "P0Y00M00DT0H00M04.000S",
     fmt=0x4e12f9 "V -", args=args at entry=0x7ffc07eef6f8) at 
237	                len = ngx_min(((size_t) (last - buf)), v->len);

It seems that v->len is not filled ?!
(gdb) print v->len
Cannot access memory at address 0x90

Using the form :

p = ngx_slprintf(p, last, "- %S -", dacf->;

work well.

Is %V not supposed to be used with ngx_str_t ?


Raphael Mazelier

More information about the nginx-devel mailing list