dcmjs 0.52.1 → 0.52.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.
- package/build/dcmjs.es.js +17 -1
- package/build/dcmjs.es.js.map +1 -1
- package/build/dcmjs.js +17 -1
- package/build/dcmjs.js.map +1 -1
- package/build/dcmjs.min.js +1 -1
- package/build/dcmjs.min.js.map +1 -1
- package/package.json +1 -1
package/build/dcmjs.js
CHANGED
|
@@ -8146,7 +8146,14 @@
|
|
|
8146
8146
|
value: function slice() {
|
|
8147
8147
|
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
8148
8148
|
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.size;
|
|
8149
|
-
|
|
8149
|
+
// Clamp to the data actually held, the way ArrayBuffer.prototype.slice
|
|
8150
|
+
// does. Otherwise a value length declared by a malformed file
|
|
8151
|
+
// allocates the declared size however few bytes are really present.
|
|
8152
|
+
// https://github.com/dcmjs-org/dcmjs/security/advisories/GHSA-xwvm-687g-rm36
|
|
8153
|
+
if (end > this.byteLength) {
|
|
8154
|
+
end = this.byteLength;
|
|
8155
|
+
}
|
|
8156
|
+
if (end <= start) {
|
|
8150
8157
|
return new Uint8Array(0).buffer;
|
|
8151
8158
|
}
|
|
8152
8159
|
var index = this.findStart(start);
|
|
@@ -10230,6 +10237,15 @@
|
|
|
10230
10237
|
} else if (this.type == 'OB') {
|
|
10231
10238
|
bytes = stream.readUint8Array(length);
|
|
10232
10239
|
}*/
|
|
10240
|
+
// A declared value length longer than the data present means a
|
|
10241
|
+
// truncated or malformed file, so read what is there rather than
|
|
10242
|
+
// allocating the declared length, which the file controls.
|
|
10243
|
+
// https://github.com/dcmjs-org/dcmjs/security/advisories/GHSA-xwvm-687g-rm36
|
|
10244
|
+
var available = stream.endOffset - stream.offset;
|
|
10245
|
+
if (length > available) {
|
|
10246
|
+
validationLog.warn("".concat(this.type, " value declares ").concat(length, " bytes but only ").concat(available, " are available - reading the available bytes"));
|
|
10247
|
+
length = available;
|
|
10248
|
+
}
|
|
10233
10249
|
bytes = stream.getBuffer(stream.offset, stream.offset + length);
|
|
10234
10250
|
stream.increment(length);
|
|
10235
10251
|
return [bytes];
|