exifreader 4.41.0 → 4.41.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/babel.config.json +1 -8
- package/bin/build.js +2 -3
- package/bin/profile.js +4 -4
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/package.json +27 -28
- package/src/image-header-iso-bmff-iloc.js +26 -1
- package/src/load-auto.js +1 -1
- package/src/package.json +1 -0
- package/webpack.config.js +0 -2
- package/bin/.eslintrc.json +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exifreader",
|
|
3
|
-
"version": "4.41.
|
|
3
|
+
"version": "4.41.1",
|
|
4
4
|
"description": "Library that parses Exif metadata in images.",
|
|
5
5
|
"author": "Mattias Wallander <mattias@wallander.eu>",
|
|
6
6
|
"repository": {
|
|
@@ -30,62 +30,61 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/core": "^7.29.7",
|
|
32
32
|
"@babel/preset-env": "^7.29.7",
|
|
33
|
-
"@
|
|
34
|
-
"@types/node": "^
|
|
33
|
+
"@eslint/js": "^9.39.5",
|
|
34
|
+
"@types/node": "^26.1.1",
|
|
35
35
|
"babel-loader": "^10.0.0",
|
|
36
|
-
"
|
|
37
|
-
"chai": "^
|
|
36
|
+
"c8": "^11.0.0",
|
|
37
|
+
"chai": "^6.2.2",
|
|
38
38
|
"cross-env": "^10.0.0",
|
|
39
|
-
"cypress": "^15.
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"eslint-plugin-cypress": "^
|
|
39
|
+
"cypress": "^15.18.1",
|
|
40
|
+
"eslint": "^9.39.4",
|
|
41
|
+
"eslint-plugin-cypress": "^6.4.1",
|
|
42
|
+
"globals": "^17.7.0",
|
|
42
43
|
"husky": "^9.0.11",
|
|
43
|
-
"linkedom": "^0.18.
|
|
44
|
+
"linkedom": "^0.18.13",
|
|
44
45
|
"mocha": "^11.7.6",
|
|
45
|
-
"npm-run-
|
|
46
|
-
"nyc": "^18.0.0",
|
|
46
|
+
"npm-run-all2": "^9.0.2",
|
|
47
47
|
"rimraf": "^5.0.5",
|
|
48
48
|
"string-replace-loader": "^3.1.0",
|
|
49
49
|
"terser-webpack-plugin": "^5.6.1",
|
|
50
|
-
"typescript": "^
|
|
51
|
-
"webpack": "5.
|
|
52
|
-
"webpack-cli": "^7.
|
|
53
|
-
"webpack-dev-server": "^5.2.
|
|
50
|
+
"typescript": "^7.0.2",
|
|
51
|
+
"webpack": "5.108.4",
|
|
52
|
+
"webpack-cli": "^7.2.1",
|
|
53
|
+
"webpack-dev-server": "^5.2.6"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "node bin/build.js",
|
|
57
57
|
"build:pages": "node bin/build-pages.js",
|
|
58
|
-
"coverage": "
|
|
58
|
+
"coverage": "c8 npm test",
|
|
59
59
|
"cypress:open": "cypress open --e2e",
|
|
60
60
|
"lint": "eslint .",
|
|
61
61
|
"start": "cross-env NODE_ENV=development webpack serve",
|
|
62
|
-
"test": "
|
|
63
|
-
"test:integration": "
|
|
62
|
+
"test": "mocha --recursive \"test/unit/\"",
|
|
63
|
+
"test:integration": "mocha \"test/integration/**/*-spec.js\"",
|
|
64
64
|
"test:integration:update": "node test/integration/update.js",
|
|
65
|
-
"test:build": "mocha test/build/test.js",
|
|
65
|
+
"test:build": "mocha test/build/test.js test/build/packaging.js",
|
|
66
66
|
"test:build:custom": "mocha --bail test/build/test-custom.js",
|
|
67
67
|
"test:build:update": "node test/build/update.js",
|
|
68
68
|
"test:e2e:chrome": "cypress run",
|
|
69
69
|
"test:e2e:firefox": "cypress run --browser firefox",
|
|
70
70
|
"test:types": "tsc --noEmit --project test/types",
|
|
71
|
-
"test:all": "npm-run-
|
|
72
|
-
"pre-commit": "npm-run-
|
|
71
|
+
"test:all": "npm-run-all2 lint test:types coverage test:e2e:chrome test:integration test:build test:build:custom",
|
|
72
|
+
"pre-commit": "npm-run-all2 lint test:types coverage test:build",
|
|
73
73
|
"postinstall": "node bin/build.js --only-with-config",
|
|
74
74
|
"prepare": "husky"
|
|
75
75
|
},
|
|
76
|
-
"
|
|
76
|
+
"c8": {
|
|
77
77
|
"check-coverage": true,
|
|
78
|
-
"statements":
|
|
79
|
-
"branches":
|
|
80
|
-
"functions":
|
|
81
|
-
"lines":
|
|
78
|
+
"statements": 93,
|
|
79
|
+
"branches": 90,
|
|
80
|
+
"functions": 98,
|
|
81
|
+
"lines": 93,
|
|
82
82
|
"reporter": [
|
|
83
83
|
"lcov",
|
|
84
84
|
"text"
|
|
85
85
|
],
|
|
86
86
|
"exclude": [
|
|
87
|
-
"test
|
|
88
|
-
"**/node_modules/*"
|
|
87
|
+
"test/**"
|
|
89
88
|
]
|
|
90
89
|
},
|
|
91
90
|
"browserslist": [
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import {get64BitValue} from './image-header-iso-bmff-utils.js';
|
|
2
2
|
|
|
3
|
+
// Absolute backstop on the number of extent objects a single iloc box may
|
|
4
|
+
// allocate, guarding against memory exhaustion from a crafted file
|
|
5
|
+
// (GHSA-pj96-35fp-cfcc). It is far above any legitimate file.
|
|
6
|
+
const MAX_TOTAL_EXTENTS = 1024 * 1024;
|
|
7
|
+
|
|
3
8
|
export function parseItemLocationBox(dataView, version, contentOffset, boxLength) {
|
|
4
9
|
const FLAGS_SIZE = 3;
|
|
5
10
|
|
|
@@ -83,8 +88,13 @@ function getItems(dataView, version, offsets, sizes, offsetSize, lengthSize, ind
|
|
|
83
88
|
|
|
84
89
|
const items = [];
|
|
85
90
|
let offset = offsets.items;
|
|
91
|
+
const extentByteSize = sizes.item.extent.extentIndex + sizes.item.extent.extentOffset + sizes.item.extent.extentLength;
|
|
92
|
+
let totalExtents = 0;
|
|
86
93
|
|
|
87
94
|
for (let i = 0; i < itemCount; i++) {
|
|
95
|
+
if (offset >= dataView.byteLength) {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
88
98
|
const item = {extents: []};
|
|
89
99
|
item.itemId = getItemId(dataView, offset, version);
|
|
90
100
|
offset += sizes.item.itemId;
|
|
@@ -96,7 +106,8 @@ function getItems(dataView, version, offsets, sizes, offsetSize, lengthSize, ind
|
|
|
96
106
|
offset += sizes.item.baseOffset;
|
|
97
107
|
item.extentCount = dataView.getUint16(offset);
|
|
98
108
|
offset += sizes.item.extentCount;
|
|
99
|
-
|
|
109
|
+
const extentCount = getBoundedExtentCount(item.extentCount, extentByteSize, offset, dataView.byteLength, MAX_TOTAL_EXTENTS - totalExtents);
|
|
110
|
+
for (let j = 0; j < extentCount; j++) {
|
|
100
111
|
const extent = {};
|
|
101
112
|
|
|
102
113
|
extent.extentIndex = getExtentIndex(dataView, version, offset, indexSize);
|
|
@@ -108,6 +119,7 @@ function getItems(dataView, version, offsets, sizes, offsetSize, lengthSize, ind
|
|
|
108
119
|
|
|
109
120
|
item.extents.push(extent);
|
|
110
121
|
}
|
|
122
|
+
totalExtents += extentCount;
|
|
111
123
|
|
|
112
124
|
items.push(item);
|
|
113
125
|
}
|
|
@@ -115,6 +127,19 @@ function getItems(dataView, version, offsets, sizes, offsetSize, lengthSize, ind
|
|
|
115
127
|
return items;
|
|
116
128
|
}
|
|
117
129
|
|
|
130
|
+
// An extent whose size fields are all zero occupies no bytes and carries no
|
|
131
|
+
// location, so it cannot be substantiated by the buffer and none are produced
|
|
132
|
+
// (GHSA-pj96-35fp-cfcc). Otherwise the count is limited by the bytes left in
|
|
133
|
+
// the buffer and by an absolute backstop, keeping allocation proportional to
|
|
134
|
+
// the input size.
|
|
135
|
+
function getBoundedExtentCount(declaredCount, extentByteSize, offset, byteLength, remainingBudget) {
|
|
136
|
+
if (extentByteSize === 0) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
const fitInBuffer = Math.floor((byteLength - offset) / extentByteSize);
|
|
140
|
+
return Math.max(0, Math.min(declaredCount, fitInBuffer, remainingBudget));
|
|
141
|
+
}
|
|
142
|
+
|
|
118
143
|
function getItemId(dataView, offset, version) {
|
|
119
144
|
if (version < 2) {
|
|
120
145
|
return dataView.getUint16(offset);
|
package/src/load-auto.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
|
-
/* global Buffer
|
|
5
|
+
/* global Buffer */
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
fetchRange, nodeGetRange, readLocalFileRange, readFileObjectRange,
|
package/src/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "module"}
|
package/webpack.config.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
|
-
/* eslint-env node */
|
|
6
|
-
|
|
7
5
|
const path = require('path');
|
|
8
6
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
9
7
|
const findConfigFromClosestPackageJson = require('./bin/findDependentConfig');
|