Welcome! Log In Create A New Profile

Advanced

proposed solution for ticket 686 (With some condition, ngx_palloc() function will alloc a illegal memory address)

Chris Newton
December 10, 2020 11:18AM
Ticket 686 is marked as 'wontfix' as the constraints on the size of the
memory pool are documented.

I'd like to suggest that the constraints are enforced by the code to
prevent issues. eg.,

*--- a/src/core/ngx_palloc.c*

*+++ b/src/core/ngx_palloc.c*

@@ -20,6 +20,12 @@ ngx_create_pool(size_t size, ngx_log_t *log)

{

ngx_pool_t *p;



+ if (size < NGX_MIN_POOL_SIZE)

+ size = NGX_MIN_POOL_SIZE;

+

+ if (size % NGX_POOL_ALIGNMENT != 0)

+ size = ngx_align(size, NGX_POOL_ALIGNMENT);

+

p = ngx_memalign(NGX_POOL_ALIGNMENT, size, log);

if (p == NULL) {

return NULL;

TIA

Chris
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

proposed solution for ticket 686 (With some condition, ngx_palloc() function will alloc a illegal memory address)

Chris Newton 326 December 10, 2020 11:18AM

Re: proposed solution for ticket 686 (With some condition, ngx_palloc() function will alloc a illegal memory address)

Maxim Dounin 148 December 10, 2020 12:38PM



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

Online Users

Guests: 300
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