Welcome! Log In Create A New Profile

Advanced

[njs] Fixed lvlhsh test on 64-bit big-endian systems.

Valentin Bartenev
November 15, 2018 06:58AM
details: http://hg.nginx.org/njs/rev/7f0f7d149709
branches:
changeset: 652:7f0f7d149709
user: Valentin Bartenev <vbart@nginx.com>
date: Thu Nov 15 12:45:02 2018 +0300
description:
Fixed lvlhsh test on 64-bit big-endian systems.

The nxt_murmur_hash2() generated 4-byte hash that was stored in uintptr_t,
which was 8 bytes long on 64-bit systems. At each iteration, it took the
previous key and hashed it again.

The problem was that it took only the first 4 bytes of the key, and these
4 bytes were always zero on 64-bit big-endian system. That resulted in
equal keys at each iteration.

The bug was discovered on IBM/S390x.

diffstat:

nxt/test/lvlhsh_unit_test.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 52e540f16740 -r 7f0f7d149709 nxt/test/lvlhsh_unit_test.c
--- a/nxt/test/lvlhsh_unit_test.c Tue Nov 13 15:25:00 2018 +0300
+++ b/nxt/test/lvlhsh_unit_test.c Thu Nov 15 12:45:02 2018 +0300
@@ -196,7 +196,7 @@ static const nxt_mem_proto_t mem_cache_
static nxt_int_t
lvlhsh_unit_test(nxt_uint_t n)
{
- uintptr_t key;
+ uint32_t key;
nxt_uint_t i;
nxt_lvlhsh_t lh;
nxt_lvlhsh_each_t lhe;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed lvlhsh test on 64-bit big-endian systems.

Valentin Bartenev 476 November 15, 2018 06:58AM



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

Online Users

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