Skip to content

Commit

Permalink
Fixes ig
Browse files Browse the repository at this point in the history
  • Loading branch information
lafkpages committed Oct 28, 2023
1 parent c6e7ab1 commit b172f2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/asar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +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();
const headerSize =
createFromBuffer(asarBytes.subarray(0, 16))
.createIterator()
.readUInt32() + 16;
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
debug(2, "[new Asar] Reading header");
const rawHeader = asarBytes.subarray(16, headerSize + 16).toString();
const rawHeader = asarBytes.subarray(16, headerSize).toString();
const header = JSON.parse(rawHeader) as unknown;

if (opts.noHeaderTypeChecks) {
Expand Down
2 changes: 1 addition & 1 deletion src/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class FileEntry extends BaseEntry implements FileEntryData {
* @param headerSize The size of the ASAR header.
*/
getOffsetFromAsarData(headerSize: number) {
return this.offsetAsNumber + 17 + headerSize;
return this.offsetAsNumber + headerSize + 1;
}

/**
Expand Down

0 comments on commit b172f2e

Please sign in to comment.