bson 6.5.0 → 6.5.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.5.0",
17
+ "version": "6.5.1",
18
18
  "author": {
19
19
  "name": "The MongoDB NodeJS Team",
20
20
  "email": "dbx-node@mongodb.com"
@@ -44,14 +44,23 @@ export const NumberUtils = {
44
44
 
45
45
  /** Reads a little-endian 64-bit integer from source */
46
46
  getBigInt64LE(source: Uint8Array, offset: number): bigint {
47
- const lo = NumberUtils.getUint32LE(source, offset);
48
- const hi = NumberUtils.getUint32LE(source, offset + 4);
47
+ // eslint-disable-next-line no-restricted-globals
48
+ const hi = BigInt(
49
+ source[offset + 4] +
50
+ source[offset + 5] * 256 +
51
+ source[offset + 6] * 65536 +
52
+ (source[offset + 7] << 24)
53
+ ); // Overflow
49
54
 
50
- /*
51
- eslint-disable-next-line no-restricted-globals
52
- -- This is allowed since this helper should not be called unless bigint features are enabled
53
- */
54
- return (BigInt(hi) << BigInt(32)) + BigInt(lo);
55
+ // eslint-disable-next-line no-restricted-globals
56
+ const lo = BigInt(
57
+ source[offset] +
58
+ source[offset + 1] * 256 +
59
+ source[offset + 2] * 65536 +
60
+ source[offset + 3] * 16777216
61
+ );
62
+ // eslint-disable-next-line no-restricted-globals
63
+ return (hi << BigInt(32)) + lo;
55
64
  },
56
65
 
57
66
  /** Reads a little-endian 64-bit float from source */