Welcome! Log In Create A New Profile

Advanced

ngx_str_rbtree_lookup gets uint32 hash

October 26, 2020 08:22AM
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?

Thanks

Eran

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

ngx_str_rbtree_lookup gets uint32 hash

erankor 686 October 26, 2020 08:22AM



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

Online Users

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