ngx_str_rbtree_lookup gets uint32 hash

Eran Kornblau eran.kornblau at
Mon Oct 26 12:20:52 UTC 2020

Some pitfall I stepped on a couple of times, so thought I'd share here -
ngx_str_rbtree_lookup currently uses uint32_t for the hash param, however ngx_rbtree_key_t is ngx_uint_t.
This means that if someone calculates a hash that is potentially int64 (e.g. using ngx_hash_key/_lc),
the nodes will not be found when looking them up the rbtree.

Even though it doesn't matter for nginx core (all places that reference this function in core use crc32 for the hash...)
IMHO it would be good to change the function signature to use ngx_uint_t or ngx_rbtree_key_t.
Such a change is not expected to cause any backward compatibility issue for modules that depend on this function.

Makes sense?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list