nginx: worker process: malloc(): memory corruption: 0x0000000000b6bdb0 ***

honwel nginx-forum at nginx.us
Tue Mar 26 02:23:20 UTC 2013


i use valgrind to check memory leak, and have detected some error:

==2243== Invalid write of size 1
==2243==    at 0x4A08088: memcpy (mc_replace_strmem.c:628)
==2243==    by 0x4448C9: ngx_http_proxy_subs_headers
(ngx_http_proxy_subs_filter.c:149)
==2243==    by 0x45B2FB: ngx_http_proxy_create_request
(ngx_http_proxy_module.c:1235)
==2243==    by 0x43EA7E: ngx_http_upstream_init_request
(ngx_http_upstream.c:505)
==2243==    by 0x43EE92: ngx_http_upstream_init (ngx_http_upstream.c:446)
==2243==    by 0x4361C0: ngx_http_read_client_request_body
(ngx_http_request_body.c:59)
==2243==    by 0x459972: ngx_http_proxy_handler
(ngx_http_proxy_module.c:703)
==2243==    by 0x42BD23: ngx_http_core_content_phase
(ngx_http_core_module.c:1396)
==2243==    by 0x4269A2: ngx_http_core_run_phases
(ngx_http_core_module.c:877)
==2243==    by 0x426A9D: ngx_http_handler (ngx_http_core_module.c:860)
==2243==    by 0x430661: ngx_http_process_request (ngx_http_request.c:1874)
==2243==    by 0x430D97: ngx_http_process_request_headers
(ngx_http_request.c:1318)
==2243==  Address 0x5a1f29a is not stack'd, malloc'd or (recently) free'd
==2243== 
==2243== Invalid write of size 8
==2243==    at 0x4A080B3: memcpy (mc_replace_strmem.c:628)
==2243==    by 0x4448C9: ngx_http_proxy_subs_headers
(ngx_http_proxy_subs_filter.c:149)
==2243==    by 0x45B2FB: ngx_http_proxy_create_request
(ngx_http_proxy_module.c:1235)
==2243==    by 0x43EA7E: ngx_http_upstream_init_request
(ngx_http_upstream.c:505)
==2243==    by 0x43EE92: ngx_http_upstream_init (ngx_http_upstream.c:446)
==2243==    by 0x4361C0: ngx_http_read_client_request_body
(ngx_http_request_body.c:59)
==2243==    by 0x459972: ngx_http_proxy_handler
(ngx_http_proxy_module.c:703)
==2243==    by 0x42BD23: ngx_http_core_content_phase
(ngx_http_core_module.c:1396)
==2243==    by 0x4269A2: ngx_http_core_run_phases
(ngx_http_core_module.c:877)
==2243==    by 0x426A9D: ngx_http_handler (ngx_http_core_module.c:860)
==2243==    by 0x430661: ngx_http_process_request (ngx_http_request.c:1874)


due to ngx_copy() out of bound, and caused by my code.  so, i modify the
corrspongding code, it's running ok until now.

thanks for Maxim Dounin !

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,237393,237778#msg-237778



More information about the nginx mailing list