file-type 15.0.0 → 15.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.
Files changed (2) hide show
  1. package/core.js +5 -1
  2. package/package.json +2 -1
package/core.js CHANGED
@@ -967,6 +967,10 @@ async function _fromTokenizer(tokenizer) {
967
967
 
968
968
  do {
969
969
  const chunk = await readChunkHeader();
970
+ if (chunk.length < 0) {
971
+ return; // Invalid chunk length
972
+ }
973
+
970
974
  switch (chunk.type) {
971
975
  case 'IDAT':
972
976
  return {
@@ -981,7 +985,7 @@ async function _fromTokenizer(tokenizer) {
981
985
  default:
982
986
  await tokenizer.ignore(chunk.length + 4); // Ignore chunk-data + CRC
983
987
  }
984
- } while (tokenizer.position < tokenizer.fileInfo.size);
988
+ } while (tokenizer.position + 8 < tokenizer.fileInfo.size);
985
989
 
986
990
  return {
987
991
  ext: 'png',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-type",
3
- "version": "15.0.0",
3
+ "version": "15.0.1",
4
4
  "description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/file-type",
@@ -31,6 +31,7 @@
31
31
  "mime",
32
32
  "file",
33
33
  "type",
34
+ "magic",
34
35
  "archive",
35
36
  "image",
36
37
  "img",