From c55436e36fa9553373f14898c0dd04bad6ee4715 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 19 Nov 2018 11:58:17 +0100 Subject: luci-base: cbi.js: fix sfh() signedness bug for strings with 3 trailing bytes Replace a sign-propagating right shift by a zero-filling right shift to avoid calculating a wrong hash code in the three-trailing-bytes case. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 6cd799b92..0e9590681 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -60,7 +60,7 @@ function sfh(s) { hash += ((bytes[off + 1] << 8) + bytes[off]) >>> 0; hash = (hash ^ (hash << 16)) >>> 0; hash = (hash ^ (bytes[off + 2] << 18)) >>> 0; - hash += hash >> 11; + hash += hash >>> 11; break; case 2: -- cgit v1.2.3