styled-exceljs 0.21.4 → 0.21.6

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.
@@ -160,7 +160,7 @@ var DO_NOT_EXPORT_CODEPAGE = true;
160
160
  /*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false, Set:false, Float32Array:false, Int8Array:false */
161
161
  var XLSX = {};
162
162
  function make_xlsx_lib(XLSX){
163
- XLSX.version = '0.21.4';
163
+ XLSX.version = '0.21.6';
164
164
  var current_codepage = 1200, current_ansi = 1252;
165
165
  /*global cptable:true, window */
166
166
  var $cptable;
@@ -1819,8 +1819,12 @@ sleuth_fat(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs);
1819
1819
  /** Chains */
1820
1820
  var sector_list = make_sector_list(sectors, dir_start, fat_addrs, ssz);
1821
1821
 
1822
- if(dir_start < sector_list.length) sector_list[dir_start].name = "!Directory";
1823
- if(nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT";
1822
+ if(!sector_list[dir_start]) throw new Error("CFB directory chain is missing");
1823
+ sector_list[dir_start].name = "!Directory";
1824
+ /* A stale MiniFAT location is irrelevant when no live entry uses mini streams.
1825
+ * Validate required chains when reading their live directory entries. */
1826
+ if(nmfs > 0 && sector_list[minifat_start]) sector_list[minifat_start].name = "!MiniFAT";
1827
+ if(!sector_list[fat_addrs[0]]) throw new Error("CFB FAT chain is missing");
1824
1828
  sector_list[fat_addrs[0]].name = "!FAT";
1825
1829
  sector_list.fat_addrs = fat_addrs;
1826
1830
  sector_list.ssz = ssz;
@@ -2032,10 +2036,14 @@ function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, Fil
2032
2036
  if(mtime !== 0) o.mt = read_date(blob, blob.l-8);
2033
2037
  o.start = blob.read_shift(4, 'i');
2034
2038
  o.size = blob.read_shift(4, 'i');
2039
+ if(o.type === 0) { o.size = 0; o.start = ENDOFCHAIN; }
2035
2040
  if(o.size < 0 && o.start < 0) { o.size = o.type = 0; o.start = ENDOFCHAIN; o.name = ""; }
2036
2041
  if(o.type === 5) { /* root */
2037
- minifat_store = o.start;
2038
- if(nmfs > 0 && minifat_store !== ENDOFCHAIN) sector_list[minifat_store].name = "!StreamData";
2042
+ minifat_store = o.size > 0 ? o.start : ENDOFCHAIN;
2043
+ if(o.size > 0 && nmfs > 0) {
2044
+ if(!sector_list[minifat_store]) throw new Error("CFB root mini stream is missing");
2045
+ sector_list[minifat_store].name = "!StreamData";
2046
+ }
2039
2047
  /*minifat_size = o.size;*/
2040
2048
  } else if(o.size >= 4096 /* MSCSZ */) {
2041
2049
  o.storage = 'fat';
@@ -2045,8 +2053,11 @@ function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, Fil
2045
2053
  } else {
2046
2054
  o.storage = 'minifat';
2047
2055
  if(o.size < 0) o.size = 0;
2048
- else if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
2049
- o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
2056
+ else if(o.type === 2 && o.size > 0) {
2057
+ if(nmfs < 1 || !sector_list[mini]) throw new Error("CFB MiniFAT chain is missing for stream: " + o.name);
2058
+ if(!sector_list[minifat_store]) throw new Error("CFB root mini stream is missing");
2059
+ o.content = get_mfat_entry(o, sector_list[minifat_store].data, sector_list[mini].data);
2060
+ if(o.content.length !== o.size) throw new Error("CFB mini stream is truncated: " + o.name);
2050
2061
  }
2051
2062
  }
2052
2063
  if(o.content) prep_blob(o.content, 0);
@@ -3376,7 +3387,6 @@ exports.utils = {
3376
3387
 
3377
3388
  return exports;
3378
3389
  })();
3379
-
3380
3390
  var _fs;
3381
3391
  function set_fs(fs) { _fs = fs; }
3382
3392