From afda5c6345f4c0b274ae8084bfbd371169791c57 Mon Sep 17 00:00:00 2001 From: zousar Date: Fri, 11 Apr 2025 00:25:20 -0600 Subject: Avoid signed overflow using BigInt Bias for use of BigInt when consuming integer fields in compact binary to avoid values showing up as negative due to overflow on the Number type. --- src/zenserver/frontend/html/util/compactbinary.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/zenserver/frontend/html/util/compactbinary.js') diff --git a/src/zenserver/frontend/html/util/compactbinary.js b/src/zenserver/frontend/html/util/compactbinary.js index 366ec6aff..90e4249f6 100644 --- a/src/zenserver/frontend/html/util/compactbinary.js +++ b/src/zenserver/frontend/html/util/compactbinary.js @@ -284,7 +284,7 @@ CbFieldView.prototype.as_array = function() } //////////////////////////////////////////////////////////////////////////////// -CbFieldView.prototype.as_value = function(int_type=Number) +CbFieldView.prototype.as_value = function(int_type=BigInt) { switch (CbFieldTypeOps.get_type(this.get_type())) { @@ -388,8 +388,8 @@ CbObjectView.prototype.to_js_object = function() } if (node.is_string()) return node.as_value(); - if (node.is_float()) return node.as_value(); if (node.is_integer()) return node.as_value(); + if (node.is_float()) return node.as_value(); var ret = node.as_value(); if (ret instanceof Uint8Array) -- cgit v1.2.3