summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-11-19 11:58:17 +0100
committerJo-Philipp Wich <jo@mein.io>2018-11-19 11:58:17 +0100
commitc55436e36fa9553373f14898c0dd04bad6ee4715 (patch)
treee341c61631de638a4f34772b23777401cfbf95d3 /modules
parent2babc47ae2562cc123ea9048197996a0e3a223b1 (diff)
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 <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index 6cd799b922..0e95906812 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: