bson 6.8.0 → 6.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "vendor"
15
15
  ],
16
16
  "types": "bson.d.ts",
17
- "version": "6.8.0",
17
+ "version": "6.8.1",
18
18
  "author": {
19
19
  "name": "The MongoDB NodeJS Team",
20
20
  "email": "dbx-node@mongodb.com"
@@ -79,14 +79,23 @@ export const NumberUtils: NumberUtils = {
79
79
 
80
80
  /** Reads a little-endian 64-bit integer from source */
81
81
  getBigInt64LE(source: Uint8Array, offset: number): bigint {
82
- const lo = NumberUtils.getUint32LE(source, offset);
83
- const hi = NumberUtils.getUint32LE(source, offset + 4);
84
-
85
- /*
86
- eslint-disable-next-line no-restricted-globals
87
- -- This is allowed since this helper should not be called unless bigint features are enabled
88
- */
89
- return (BigInt(hi) << BigInt(32)) + BigInt(lo);
82
+ // eslint-disable-next-line no-restricted-globals
83
+ const hi = BigInt(
84
+ source[offset + 4] +
85
+ source[offset + 5] * 256 +
86
+ source[offset + 6] * 65536 +
87
+ (source[offset + 7] << 24)
88
+ ); // Overflow
89
+
90
+ // eslint-disable-next-line no-restricted-globals
91
+ const lo = BigInt(
92
+ source[offset] +
93
+ source[offset + 1] * 256 +
94
+ source[offset + 2] * 65536 +
95
+ source[offset + 3] * 16777216
96
+ );
97
+ // eslint-disable-next-line no-restricted-globals
98
+ return (hi << BigInt(32)) + lo;
90
99
  },
91
100
 
92
101
  /** Reads a little-endian 64-bit float from source */