<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nginx.git/src/core/ngx_hash.c, branch release-1.28.3</title>
<subtitle>nginx</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/'/>
<entry>
<title>Core: removed unnecessary restriction in hash initialization.</title>
<updated>2021-08-19T17:51:27+00:00</updated>
<author>
<name>Alexey Radkov</name>
<email>alexey.radkov@gmail.com</email>
</author>
<published>2021-08-19T17:51:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=3253b346fb8b067d68a79ae72e08a376f234b0b3'/>
<id>3253b346fb8b067d68a79ae72e08a376f234b0b3</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed memory leak on error, missed in c3f60d618c17.</title>
<updated>2019-07-19T14:50:00+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2019-07-19T14:50:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=c3fd5f7e76343c899747ec58ae703540e7e9e69a'/>
<id>c3fd5f7e76343c899747ec58ae703540e7e9e69a</id>
<content type='text'>
Found by Coverity (CID 1451664).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Found by Coverity (CID 1451664).
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed segfault with too large bucket sizes (ticket #1806).</title>
<updated>2019-07-18T15:27:44+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2019-07-18T15:27:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=551640703a502a252b24c84d1b9e6541ee88de34'/>
<id>551640703a502a252b24c84d1b9e6541ee88de34</id>
<content type='text'>
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().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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().
</pre>
</div>
</content>
</entry>
<entry>
<title>Style.</title>
<updated>2016-10-14T16:48:26+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2016-10-14T16:48:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=71841601d2e98e875512bf626e04866fceb4c04c'/>
<id>71841601d2e98e875512bf626e04866fceb4c04c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed segfault with null in wildcard hash names.</title>
<updated>2015-09-11T14:04:40+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2015-09-11T14:04:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=2c9691431229bfe33e81c5a03a70792548b28e22'/>
<id>2c9691431229bfe33e81c5a03a70792548b28e22</id>
<content type='text'>
A configuration like

    server { server_name .foo^@; }
    server { server_name .foo; }

resulted in a segmentation fault during construction of server names hash.

Reported by Markus Linnala.
Found with afl-fuzz.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A configuration like

    server { server_name .foo^@; }
    server { server_name .foo; }

resulted in a segmentation fault during construction of server names hash.

Reported by Markus Linnala.
Found with afl-fuzz.
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed potential division by zero when initializing hash.</title>
<updated>2015-08-13T13:27:17+00:00</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@nginx.com</email>
</author>
<published>2015-08-13T13:27:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=b7da4f5962d617e59f9dda3c953424df9df57d69'/>
<id>b7da4f5962d617e59f9dda3c953424df9df57d69</id>
<content type='text'>
Found by Clang Static Analyzer.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Found by Clang Static Analyzer.
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed style in the error message.</title>
<updated>2015-08-13T13:27:13+00:00</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@nginx.com</email>
</author>
<published>2015-08-13T13:27:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=e161b6a46f14a5eaf0e25cf1525114bc03aa2eab'/>
<id>e161b6a46f14a5eaf0e25cf1525114bc03aa2eab</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed potential buffer overrun when initializing hash.</title>
<updated>2015-02-24T15:37:14+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2015-02-24T15:37:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=7dd799357d7fd853b488b52ae17f9d0ee3142941'/>
<id>7dd799357d7fd853b488b52ae17f9d0ee3142941</id>
<content type='text'>
Initial size as calculated from the number of elements may be bigger
than max_size.  If this happens, make sure to set size to max_size.

Reported by Chris West.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Initial size as calculated from the number of elements may be bigger
than max_size.  If this happens, make sure to set size to max_size.

Reported by Chris West.
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed buffer overrun when hash max_size reached.</title>
<updated>2014-10-02T19:00:17+00:00</updated>
<author>
<name>Yichun Zhang</name>
<email>agentzh@gmail.com</email>
</author>
<published>2014-10-02T19:00:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=52e4dc2f74fd032dace01acbe5eb29ddf7c1ad96'/>
<id>52e4dc2f74fd032dace01acbe5eb29ddf7c1ad96</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Core: fixed hash to actually try max_size.</title>
<updated>2014-03-31T17:40:35+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2014-03-31T17:40:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=8877284863950c2a51d5b076a781437b81cd41e1'/>
<id>8877284863950c2a51d5b076a781437b81cd41e1</id>
<content type='text'>
Previously, maximum size of a hash table built was (max_size - 1).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, maximum size of a hash table built was (max_size - 1).
</pre>
</div>
</content>
</entry>
</feed>
