Welcome! Log In Create A New Profile

Advanced

RE: Problem using %V in snprintf

June 05, 2018 03:48PM
> -----Original Message-----
> From: nginx-devel [mailto:nginx-devel-bounces@nginx.org] On Behalf Of Raphael Mazelier
> Sent: Tuesday, June 5, 2018 10:42 PM
> To: nginx-devel@nginx.org
> Subject: Problem using %V in snprintf
>
> 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 :
> https://github.com/ut0mt8/nginx-rtmp-module/tree/cenc/dash/ )
>
> A detail puzzle me.
>
> "wdv_data" is config directive filled with base64 text:
>
> { ngx_string("dash_wdv_data"),
> NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
> ngx_conf_set_str_slot,
> NGX_RTMP_APP_CONF_OFFSET,
> 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);
>
You are missing a '&', %V expects ngx_str_t* while you passed ngx_str_t

Eran

> 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@entry=0x7ffc07eef6f8) at
> src/core/ngx_string.c:237
> 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->wdv_data.data);
>
> work well.
>
> Is %V not supposed to be used with ngx_str_t ?
>
> Best,
>
> --
> Raphael Mazelier
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Problem using %V in snprintf

Raphael Mazelier 589 June 05, 2018 03:44PM

RE: Problem using %V in snprintf

erankor 645 June 05, 2018 03:48PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 142
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready