update electron to v43
All checks were successful
Android Build / publish (push) Successful in 55s
Linux Build / publish (push) Successful in 1m6s

This commit is contained in:
olcxja 2026-07-09 22:38:33 +02:00
commit fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions

View file

@ -57,6 +57,10 @@ const SAW_VALID_ENTRY = Symbol('sawValidEntry');
const SAW_NULL_BLOCK = Symbol('sawNullBlock');
const SAW_EOF = Symbol('sawEOF');
const CLOSESTREAM = Symbol('closeStream');
const MAX_DECOMPRESSION_RATIO = 1000;
const COMPRESSEDBYTESREAD = Symbol('compressedBytesRead');
const DECOMPRESSEDBYTESREAD = Symbol('decompressedBytesRead');
const CHECKDECOMPRESSIONRATIO = Symbol('checkDecompressionRatio');
const noop = () => true;
export class Parser extends EE {
file;
@ -65,6 +69,7 @@ export class Parser extends EE {
filter;
brotli;
zstd;
maxDecompressionRatio;
writable = true;
readable = false;
[QUEUE] = [];
@ -84,6 +89,8 @@ export class Parser extends EE {
[WRITING] = false;
[CONSUMING] = false;
[EMITTEDEND] = false;
[COMPRESSEDBYTESREAD] = 0;
[DECOMPRESSEDBYTESREAD] = 0;
constructor(opt = {}) {
super();
this.file = opt.file || '';
@ -106,6 +113,10 @@ export class Parser extends EE {
});
}
this.strict = !!opt.strict;
this.maxDecompressionRatio =
typeof opt.maxDecompressionRatio === 'number' ?
opt.maxDecompressionRatio
: MAX_DECOMPRESSION_RATIO;
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
// Unlike gzip, brotli doesn't have any magic bytes to identify it
@ -359,11 +370,23 @@ export class Parser extends EE {
}
}
abort(error) {
if (this[ABORTED]) {
return;
}
this[ABORTED] = true;
this.emit('abort', error);
// always throws, even in non-strict mode
this.warn('TAR_ABORT', error, { recoverable: false });
}
[CHECKDECOMPRESSIONRATIO](chunk) {
this[DECOMPRESSEDBYTESREAD] += chunk.length;
const ratio = this[DECOMPRESSEDBYTESREAD] / this[COMPRESSEDBYTESREAD];
if (ratio > this.maxDecompressionRatio) {
this.abort(new Error(`max decompression ratio exceeded: ${ratio.toFixed(2)} > ${this.maxDecompressionRatio}`));
return false;
}
return true;
}
write(chunk, encoding, cb) {
if (typeof encoding === 'function') {
cb = encoding;
@ -447,13 +470,22 @@ export class Parser extends EE {
this[UNZIP] === undefined ? new Unzip({})
: isZstd ? new ZstdDecompress({})
: new BrotliDecompress({});
this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
this[UNZIP].on('error', er => this.abort(er));
this[UNZIP].on('data', chunk => {
if (this[CHECKDECOMPRESSIONRATIO](chunk)) {
this[CONSUMECHUNK](chunk);
}
});
this[UNZIP].on('error', er => {
if (!this[ABORTED]) {
this.abort(er);
}
});
this[UNZIP].on('end', () => {
this[ENDED] = true;
this[CONSUMECHUNK]();
});
this[WRITING] = true;
this[COMPRESSEDBYTESREAD] += chunk.length;
const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk);
this[WRITING] = false;
cb?.();
@ -462,6 +494,7 @@ export class Parser extends EE {
}
this[WRITING] = true;
if (this[UNZIP]) {
this[COMPRESSEDBYTESREAD] += chunk.length;
this[UNZIP].write(chunk);
}
else {
@ -492,7 +525,7 @@ export class Parser extends EE {
!this[CONSUMING]) {
this[EMITTEDEND] = true;
const entry = this[WRITEENTRY];
if (entry && entry.blockRemain) {
if (entry?.blockRemain) {
// truncated, likely a damaged file
const have = this[BUFFER] ? this[BUFFER].length : 0;
this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry });
@ -586,8 +619,10 @@ export class Parser extends EE {
if (!this[ABORTED]) {
if (this[UNZIP]) {
/* c8 ignore start */
if (chunk)
if (chunk) {
this[COMPRESSEDBYTESREAD] += chunk.length;
this[UNZIP].write(chunk);
}
/* c8 ignore stop */
this[UNZIP].end();
}