update electron to v43

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

@ -41,6 +41,7 @@ exports.Header = void 0;
const node_path_1 = require("node:path");
const large = __importStar(require("./large-numbers.js"));
const types = __importStar(require("./types.js"));
const notNegative = (n) => n === undefined || n < 0 ? undefined : n;
class Header {
cksumValid = false;
needPax = false;
@ -78,22 +79,44 @@ class Header {
if (!buf || !(buf.length >= off + 512)) {
throw new Error('need 512 bytes for header');
}
this.path = ex?.path ?? decString(buf, off, 100);
this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
// Decode the typeflag (independent of any pending PAX/GNU extended header)
// up front so we can tell whether THIS block is itself an intermediary
// extension header (PAX `x`/`g`, GNU long-name `L`, GNU long-link `K`).
// Per POSIX pax, a PAX extended header describes the *next file entry*, not
// the extension headers that may sit between it and that file. Applying the
// pending PAX overrides (notably `size`) to an intervening `L`/`K`/`x`/`g`
// header desynchronizes the stream relative to other tar implementations
// and enables tar interpretation-conflict / file-smuggling attacks.
const t = decString(buf, off + 156, 1);
const isNormalFS = types.normalFsTypes.has(t);
const exForFields = isNormalFS ? ex : undefined;
const gexForFields = isNormalFS ? gex : undefined;
this.path = exForFields?.path ?? decString(buf, off, 100);
this.mode =
exForFields?.mode ??
gexForFields?.mode ??
decNumber(buf, off + 100, 8);
this.uid =
exForFields?.uid ?? gexForFields?.uid ?? decNumber(buf, off + 108, 8);
this.gid =
exForFields?.gid ?? gexForFields?.gid ?? decNumber(buf, off + 116, 8);
this.size = notNegative(exForFields?.size ??
gexForFields?.size ??
decNumber(buf, off + 124, 12));
this.mtime =
exForFields?.mtime ??
gexForFields?.mtime ??
decDate(buf, off + 136, 12);
this.cksum = decNumber(buf, off + 148, 12);
// if we have extended or global extended headers, apply them now
// See https://github.com/npm/node-tar/pull/187
// Apply global before local, so it overrides
if (gex)
this.#slurp(gex, true);
if (ex)
this.#slurp(ex);
// Apply global before local, so it overrides. Never slurp the pending
// extended-header fields onto an intermediary extension header.
if (gexForFields)
this.#slurp(gexForFields, true);
if (exForFields)
this.#slurp(exForFields);
// old tar versions marked dirs as a file with a trailing /
const t = decString(buf, off + 156, 1);
if (types.isCode(t)) {
this.#type = t || '0';
}
@ -111,12 +134,24 @@ class Header {
this.linkpath = decString(buf, off + 157, 100);
if (buf.subarray(off + 257, off + 265).toString() === 'ustar\u000000') {
/* c8 ignore start */
this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
this.uname =
exForFields?.uname ??
gexForFields?.uname ??
decString(buf, off + 265, 32);
this.gname =
exForFields?.gname ??
gexForFields?.gname ??
decString(buf, off + 297, 32);
this.devmaj =
ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
exForFields?.devmaj ??
gexForFields?.devmaj ??
decNumber(buf, off + 329, 8) ??
0;
this.devmin =
ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
exForFields?.devmin ??
gexForFields?.devmin ??
decNumber(buf, off + 337, 8) ??
0;
/* c8 ignore stop */
if (buf[off + 475] !== 0) {
// definitely a prefix, definitely >130 chars.
@ -153,6 +188,7 @@ class Header {
// null/undefined values are ignored.
return !(v === null ||
v === undefined ||
(k === 'size' && Number(v) < 0) ||
(k === 'path' && gex) ||
(k === 'linkpath' && gex) ||
k === 'global');