exifreader 4.48.0 → 4.48.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/README.md CHANGED
@@ -202,20 +202,25 @@ come straight from the image and can contain arbitrary text, including HTML-like
202
202
  markup. Never insert them into a page as HTML (for example through `innerHTML`)
203
203
  without escaping or sanitizing them first, otherwise a crafted image could lead
204
204
  to cross-site scripting. Use `textContent`, your framework's escaping, or a
205
- sanitizer such as DOMPurify when displaying metadata. The property names inside
206
- a tag value come from the image too, and a tag whose name is `__proto__` is kept
207
- under that name as a regular property, so it does not replace the prototype of
208
- the object holding it. A tag whose name comes from the image and is the name of
209
- an `Object.prototype` method, such as `hasOwnProperty`, `toString` or
210
- `constructor`, is returned under that name with `_` appended
211
- (`hasOwnProperty_`), so it does not hide the method on the result object or on
212
- a group object, and `includeTags` and `excludeTags` match it by that returned
213
- name. Property names inside a tag value are not changed in this way. A value
214
- parsed from an XMP `rdf:value` element that holds child elements other than a
215
- list is returned as an object without a prototype.
216
- Such an object has no inherited methods, and copying it into an object of your
217
- own with `Object.assign` or a deep merge helper without filtering the keys could
218
- let a crafted image replace that object's prototype.
205
+ sanitizer such as DOMPurify when displaying metadata.
206
+
207
+ The property names inside a tag value come from the image too, and a tag whose
208
+ name is `__proto__` is kept under that name as a regular property, so it does
209
+ not replace the prototype of the object holding it. A tag whose name comes from
210
+ the image and is the name of an `Object.prototype` method, such as
211
+ `hasOwnProperty`, `toString` or `constructor`, is returned under that name with
212
+ `_` appended (`hasOwnProperty_`), so it does not hide the method on the result
213
+ object or on a group object, and `includeTags` and `excludeTags` match it by
214
+ that returned name. The same applies to the property names inside an XMP tag
215
+ value (structure members, members of list items and children of `rdf:value`)
216
+ and to the keys of an XMP tag's `attributes`. A value parsed from an XMP
217
+ `rdf:value` element that holds child elements other than a list is returned as
218
+ an object without a prototype. An XMP qualifier in `attributes` that holds
219
+ child elements is returned as its element tree, with the element and attribute
220
+ names unchanged and kept in objects without a prototype. Such an object has no
221
+ inherited methods, and copying it into an object of your own with
222
+ `Object.assign` or a deep merge helper without filtering the keys could let a
223
+ crafted image replace that object's prototype.
219
224
 
220
225
  #### Grouping
221
226
 
@@ -490,6 +495,10 @@ Block `type` reuses the filtering-group vocabulary (`exif`, `iptc`, `xmp`,
490
495
  `icc`, `mpf`, `jfif`, `file`, `png`, `riff`, `gif`), plus `mpfImage` for the
491
496
  sub-images of an MPF Multi-Picture JPEG. The same type may appear more than
492
497
  once (multi-chunk ICC, extended XMP), one entry per physical container.
498
+ ExifReader records at most 4,096 of the containers it finds while scanning
499
+ the file; in a file with more, the last one recorded keeps its own type and is
500
+ widened to cover all the rest, so `start`, `end` and the `0..end` slice still
501
+ cover every metadata byte. `mpfImage` blocks come on top of these.
493
502
 
494
503
  Typical workflow:
495
504
 
@@ -664,6 +673,11 @@ import {DOMParser, onErrorStopParsing} from '@xmldom/xmldom';
664
673
  const tags = ExifReader.load(fileBuffer, {domParser: new DOMParser({onError: onErrorStopParsing})});
665
674
  ```
666
675
 
676
+ Use `xmldom` 0.9.12 or later. ExifReader limits how deeply XMP elements can
677
+ nest and how many markup nodes a packet can have, and it checks those limits
678
+ the way `xmldom` 0.9 reads the markup. With 0.8, a crafted file can get past
679
+ them and make parsing slow.
680
+
667
681
  The `onError` option is needed to avoid a [seemingly infinite loop for some
668
682
  XMLs](https://github.com/xmldom/xmldom/issues/501). Unfortunately `linkedom` has
669
683
  the same problem but does not have this option and will therefore get stuck on