]> git.kaiwu.me - nginx.git/commit
Core: fixed segfault with too large bucket sizes (ticket #1806).
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 18 Jul 2019 15:27:44 +0000 (18:27 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 18 Jul 2019 15:27:44 +0000 (18:27 +0300)
commit551640703a502a252b24c84d1b9e6541ee88de34
tree0b4c0f6e13b4c4d832ddf55b15d2e67a8c887c0c
parent676d1a0e947c8f39e2606997a3628ec6bdea177d
Core: fixed segfault with too large bucket sizes (ticket #1806).

To save memory hash code uses u_short to store resulting bucket sizes,
so maximum bucket size is limited to 65536 minus ngx_cacheline_size (larger
values will be aligned to 65536 which will overflow u_short).  However,
there were no checks to enforce this, and using larger bucket sizes
resulted in overflows and segmentation faults.

Appropriate safety checks to enforce this added to ngx_hash_init().
src/core/ngx_hash.c