Fixed overflow if ngx_slab_alloc() is called with very big "size" argument.
This commit is contained in:
parent
2a94bde1f0
commit
4e63f32acc
1 changed files with 2 additions and 2 deletions
|
@ -162,8 +162,8 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
|
|||
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0,
|
||||
"slab alloc: %uz", size);
|
||||
|
||||
page = ngx_slab_alloc_pages(pool, (size + ngx_pagesize - 1)
|
||||
>> ngx_pagesize_shift);
|
||||
page = ngx_slab_alloc_pages(pool, (size >> ngx_pagesize_shift)
|
||||
+ ((size % ngx_pagesize) ? 1 : 0));
|
||||
if (page) {
|
||||
p = (page - pool->pages) << ngx_pagesize_shift;
|
||||
p += (uintptr_t) pool->start;
|
||||
|
|
Loading…
Reference in a new issue