Welcome! Log In Create A New Profile


Valgrind reporting issue in connection->addr_text

May 06, 2019 02:08PM

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 "" (localhost), but at times some garbage value is appended like:\u000b0\t\u0006\u0003xW�\u0005

I am not able to understand why addr_text contains garbage value, Can someone pls help me.
Subject Author Posted

Valgrind reporting issue in connection->addr_text

bhagavathula May 06, 2019 02:08PM

Re: Valgrind reporting issue in connection->addr_text

Robert Paprocki May 06, 2019 02:14PM

Re: Valgrind reporting issue in connection->addr_text

bhagavathula May 07, 2019 05:16AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready