Skip to content

fix: detect cyclic link entries during asar path resolution - #52825

Merged
MarshallOfSound merged 2 commits into
mainfrom
fix/asar-link-cycle
Aug 16, 2026
Merged

MarshallOfSound merged 2 commits into
mainfrom
fix/asar-link-cycle

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Archive::GetFileInfo and the GetNodeFromPath/GetFilesNode pair follow ASAR link entries with no cycle detection or recursion limit, so an archive whose header contains a self-referential or mutually-referential link resolves forever, overflows the stack, and crashes the process.

  • Bound link resolution with a depth cap (kMaxLinkDepth) threaded through Archive::GetFileInfo and GetNodeFromPath/GetFilesNode; exceeding it fails the lookup like any other missing entry instead of recursing.
  • Add regression coverage with self-link, two-node-cycle, and directory-link-cycle fixtures.

Notes: Fixed a crash when resolving a path inside a malformed ASAR archive that contains cyclic link entries.

Path resolution in shell/common/asar/archive.cc followed "link" entries
with no bound. A header whose links form a cycle (an entry pointing at
itself, two entries pointing at each other, or a link that resolves back
through its own path) made Archive::GetFileInfo self-recurse and the
GetNodeFromPath/GetFilesNode pair mutually recurse until the stack was
exhausted.

Cap the number of chained link resolutions in both paths and treat an
exceeded limit as a missing entry, so a malformed header fails the lookup
gracefully instead of crashing. Legitimate archives only ever chain a few
links, so the limit does not affect valid lookups.

Notes: none
@MarshallOfSound MarshallOfSound added semver/patch backwards-compatible bug fixes target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Aug 15, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 15, 2026
@MarshallOfSound
MarshallOfSound merged commit ead494c into main Aug 16, 2026
104 of 106 checks passed
@MarshallOfSound
MarshallOfSound deleted the fix/asar-link-cycle branch August 16, 2026 11:10
@release-clerk

release-clerk Bot commented Aug 16, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a crash when resolving a path inside a malformed ASAR archive that contains cyclic link entries.

@trop

trop Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #52857

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Aug 16, 2026
@trop

trop Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #52858

@trop

trop Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #52859

@trop trop Bot added in-flight/44-x-y in-flight/42-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/42-x-y in-flight/44-x-y in-flight/43-x-y labels Aug 16, 2026
@trop trop Bot added the merged/43-x-y PR was merged to the "43-x-y" branch. label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants