mmdb-lib 3.0.0 → 3.0.2

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.
Files changed (2) hide show
  1. package/lib/decoder.js +5 -1
  2. package/package.json +7 -7
package/lib/decoder.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const utils_1 = __importDefault(require("./utils"));
7
7
  utils_1.default.assert(typeof BigInt !== 'undefined', 'Apparently you are using old version of node. Please upgrade to node 10.4.x or above.');
8
+ const MAX_INT_32 = 2_147_483_647;
8
9
  var DataType;
9
10
  (function (DataType) {
10
11
  DataType[DataType["Extended"] = 0] = "Extended";
@@ -228,7 +229,10 @@ class Decoder {
228
229
  throw new Error(`Invalid size for unsigned integer: ${size}`);
229
230
  }
230
231
  decodeString(offset, size) {
231
- return this.db.toString('utf8', offset, offset + size);
232
+ const newOffset = offset + size;
233
+ return newOffset >= MAX_INT_32
234
+ ? this.db.subarray(offset, newOffset).toString('utf8')
235
+ : this.db.toString('utf8', offset, newOffset);
232
236
  }
233
237
  decodeBigUint(offset, size) {
234
238
  if (size > 16) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mmdb-lib",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "homepage": "https://github.com/runk/mmdb-lib",
5
5
  "description": "Maxmind DB (MMDB) Library",
6
6
  "keywords": [
@@ -19,15 +19,15 @@
19
19
  "devDependencies": {
20
20
  "@types/ip-address": "7.0.0",
21
21
  "@types/mocha": "^10.0.1",
22
- "@types/node": "22.14.0",
23
- "@types/sinon": "17.0.4",
24
- "ip-address": "10.0.1",
22
+ "@types/node": "24.10.7",
23
+ "@types/sinon": "21.0.0",
24
+ "ip-address": "10.1.0",
25
25
  "mocha": "^11.0.0",
26
26
  "prettier": "^3.5.3",
27
- "semantic-release": "^24.0.0",
28
- "sinon": "20.0.0",
27
+ "semantic-release": "^25.0.0",
28
+ "sinon": "21.0.1",
29
29
  "ts-node": "^10.4.0",
30
- "typescript": "5.8.2"
30
+ "typescript": "5.9.3"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",