mmdb-lib 3.0.0 → 3.0.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/lib/decoder.js +5 -1
- package/package.json +3 -3
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
|
-
|
|
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.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"homepage": "https://github.com/runk/mmdb-lib",
|
|
5
5
|
"description": "Maxmind DB (MMDB) Library",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/ip-address": "7.0.0",
|
|
21
21
|
"@types/mocha": "^10.0.1",
|
|
22
|
-
"@types/node": "22.
|
|
22
|
+
"@types/node": "22.15.31",
|
|
23
23
|
"@types/sinon": "17.0.4",
|
|
24
24
|
"ip-address": "10.0.1",
|
|
25
25
|
"mocha": "^11.0.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"semantic-release": "^24.0.0",
|
|
28
28
|
"sinon": "20.0.0",
|
|
29
29
|
"ts-node": "^10.4.0",
|
|
30
|
-
"typescript": "5.8.
|
|
30
|
+
"typescript": "5.8.3"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|