Welcome! Log In Create A New Profile

Advanced

[nginx] Core: removed unnecessary restriction in hash initialization.

Maxim Dounin
October 26, 2021 10:18AM
details: https://hg.nginx.org/nginx/rev/2a7155733855
branches:
changeset: 7943:2a7155733855
user: Alexey Radkov <alexey.radkov@gmail.com>
date: Thu Aug 19 20:51:27 2021 +0300
description:
Core: removed unnecessary restriction in hash initialization.

Hash initialization ignores elements with key.data set to NULL.
Nevertheless, the initial hash bucket size check didn't skip them,
resulting in unnecessary restrictions on, for example, variables with
long names and with the NGX_HTTP_VARIABLE_NOHASH flag.

Fix is to update the initial hash bucket size check to skip elements
with key.data set to NULL, similarly to how it is done in other parts
of the code.

diffstat:

src/core/ngx_hash.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r 3f0ab7b6cd71 -r 2a7155733855 src/core/ngx_hash.c
--- a/src/core/ngx_hash.c Mon Oct 25 20:49:15 2021 +0300
+++ b/src/core/ngx_hash.c Thu Aug 19 20:51:27 2021 +0300
@@ -274,6 +274,10 @@ ngx_hash_init(ngx_hash_init_t *hinit, ng
}

for (n = 0; n < nelts; n++) {
+ if (names[n].key.data == NULL) {
+ continue;
+ }
+
if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
{
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Core: removed unnecessary restriction in hash initialization.

Maxim Dounin 319 October 26, 2021 10:18AM



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

Online Users

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