]> git.kaiwu.me - njs.git/commit
Memory pool: compare block addresses without overflow
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 17 Sep 2026 23:47:35 +0000 (16:47 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 18 Sep 2026 20:42:16 +0000 (13:42 -0700)
commit90ae2f41bd9170dff5402def63fba38b474abdea
tree7a2346ddc7d687ca17cfb5e88a5f253a1389595e
parentb5774ce891c334edd19e3fd17ff4878798f61462
Memory pool: compare block addresses without overflow

Previously, the rbtree comparator converted the difference between two
addresses to intptr_t.  On 32-bit systems, addresses that differ by at
least 2 GiB could produce an incorrect ordering and prevent a later block
lookup from finding its cluster.

The fix is to compare the addresses directly and return -1, 0, or 1.
This fixes a pool that remained non-empty after all allocations were freed
in the x86 memory pool test.
src/njs_mp.c