diff --git a/src/asar.ts b/src/asar.ts index aeec84d..f2f6013 100644 --- a/src/asar.ts +++ b/src/asar.ts @@ -86,17 +86,17 @@ export class Asar extends DirectoryEntry { if (asarBytes) { // Read header size debug(2, "[new Asar] Reading header size"); - const headerSize = - createFromBuffer(asarBytes.subarray(0, 16)) - .createIterator() - .readUInt32() + 16; + const headerSize = createFromBuffer(asarBytes.subarray(0, 8)) + .createIterator() + .readUInt32(); debug(2, "[new Asar] Header size:", headerSize); // Read header - // We start at 16 because 0-8 are the Pickle object containing - // the header size, and 9-15 are the header size itself + // We start at 8 because 0-8 are the Pickle object containing the header size debug(2, "[new Asar] Reading header"); - const rawHeader = asarBytes.subarray(16, headerSize).toString(); + const rawHeader = createFromBuffer(asarBytes.subarray(8, 8 + headerSize)) + .createIterator() + .readString(); const header = JSON.parse(rawHeader) as unknown; if (opts.noHeaderTypeChecks) {