mirror of https://github.com/nginx/nginx
The original comparison "(size_t) (p->d.end - m) >= size" could produce incorrect results when alignment is enabled. If ngx_align_ptr() moves m beyond p->d.end, the subtraction yields a negative value that wraps to a large unsigned integer due to the size_t cast, causing the check to pass incorrectly. This would return an invalid pointer beyond the pool boundary and corrupt p->d.last. Reordering prevents unsigned wraparound and correctly validates that the aligned pointer m has sufficient space remaining in the pool block.pull/999/head
parent
6ed1188411
commit
9dd81a8966
Loading…
Reference in new issue