Skip to content

Fix ASAR parsing failure with unpacked entries - #213

Open
asterlore wants to merge 1 commit into
crskycode:masterfrom
asterlore:master
Open

Fix ASAR parsing failure with unpacked entries#213
asterlore wants to merge 1 commit into
crskycode:masterfrom
asterlore:master

Conversation

@asterlore

Copy link
Copy Markdown

Description

Fix Electron ASAR archives failing to open when they contain unpacked entries.

Problem

GARbro already supports the ASAR format, but some valid Electron application archives cannot be opened.

For example:

  • Queens_Casino/resources/app.asar (~977 MB)

The failure was caused by Electron's asarUnpack feature.
asarUnpack is a supported and commonly used Electron packaging feature that stores selected files outside the ASAR archive in app.asar.unpacked.

These unpacked entries do not contain an offset field in the ASAR JSON index.

The previous implementation assumed every file node had an offset:

Offset = uint.Parse(dict.Offset)

When encountering unpacked entries, this caused ArgumentNullException, preventing the entire archive from being opened.

Changes

  • Added unpacked and link fields to the ASAR node model.
  • Skip unpacked/link nodes or nodes without valid offsets.
  • Use long.TryParse for offsets to support larger ASAR archives.
  • Added additional validation for truncated ASAR files and malformed JSON headers.
  • Validate entry ranges during opening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant