Valgrind reporting issue in connection->addr_text
bhagavathula
nginx-forum at forum.nginx.org
Mon May 6 18:08:58 UTC 2019
Hi,
When running Valgrind on our NGINX module for errors, found the following
errors:
==49784== Conditional jump or move depends on uninitialised value(s)
==49784== at 0x4C32D08: strlen (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==49784== by 0x6C3A328: apr_pstrdup (in
/usr/lib/x86_64-linux-gnu/libapr-1.so.0.6.3)
==49784== by 0x6C3DB3D: apr_table_add (in
/usr/lib/x86_64-linux-gnu/libapr-1.so.0.6.3)
==49784== by 0x611CC82: get_request_properties
(ta_ngx_http_module.c:329)
==49784== by 0x611CE30: get_new_token (ta_ngx_http_module.c:351)
==49784== by 0x611CF55: get_token_helper (ta_ngx_http_module.c:374)
==49784== by 0x611D4BC: ta_post_read_request_helper
(ta_ngx_http_module.c:486)
==49784== by 0x611D750: ta_post_read_request (ta_ngx_http_module.c:920)
==49784== by 0x1553E6: ngx_http_core_access_phase
(ngx_http_core_module.c:1083)
==49784== by 0x150A34: ngx_http_core_run_phases
(ngx_http_core_module.c:858)
==49784== by 0x150ADA: ngx_http_handler (ngx_http_core_module.c:841)
==49784== by 0x1594B0: ngx_http_process_request
(ngx_http_request.c:1952)
==49784== Uninitialised value was created by a heap allocation
==49784== at 0x4C31E76: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==49784== by 0x4C31F91: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==49784== by 0x14611F: ngx_memalign (ngx_alloc.c:57)
==49784== by 0x122D09: ngx_create_pool (ngx_palloc.c:23)
==49784== by 0x142CD6: ngx_event_accept (ngx_event_accept.c:161)
==49784== by 0x14D313: ngx_epoll_process_events (ngx_epoll_module.c:902)
==49784== by 0x14218D: ngx_process_events_and_timers (ngx_event.c:242)
==49784== by 0x14C2A3: ngx_single_process_cycle
(ngx_process_cycle.c:310)
==49784== by 0x1214E4: main (nginx.c:379)
The code that is causing the error is as follows:
const char *ip =(char *) (r->connection->addr_text).data;
apr_table_add(request_table, (char *) TA_PROP_CLIENT_ADDR, ip);
When printing the ip which is supposed to be "127.0.0.1" (localhost), but at
times some garbage value is appended like:
127.0.0.1 at 1\u000b0\t\u0006\u0003xW�\u0005
I am not able to understand why addr_text contains garbage value, Can
someone pls help me.
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,284065,284065#msg-284065
More information about the nginx
mailing list