Skip to content

[SharedCache] Avoid reading header fields outside of the header for iOS 10 and older#6777

Closed
droe wants to merge 1 commit into
Vector35:devfrom
droe:droe/sharedcache-platform-out-of-header-read
Closed

[SharedCache] Avoid reading header fields outside of the header for iOS 10 and older#6777
droe wants to merge 1 commit into
Vector35:devfrom
droe:droe/sharedcache-platform-out-of-header-read

Conversation

@droe
Copy link
Copy Markdown
Contributor

@droe droe commented May 3, 2025

Use mappingOffset as an upper bound for the header size, and avoid reading any header fields from beyond that offset.

  • Avoids printing garbage platform values for old (iOS 10 and older) DSCs.
  • Avoids picking the wrong platform in case the bytes at the offset outside of the header just happen to have a value that is also a valid platform value, which is unlikely, but not impossible.

Fixes the remaining aspects of #6073.

Tested against 5.1.7363-dev (acd6c39c)

Use mappingOffset as an upper bound for the header size, and avoid
reading any header fields from beyond that offset.
@emesare
Copy link
Copy Markdown
Member

emesare commented May 3, 2025

LGTM

@emesare emesare self-assigned this May 3, 2025
@emesare emesare added the File Format: SharedCache Issue with the dyld_shared_cache plugin label May 3, 2025
@emesare emesare added this to the Helion milestone May 3, 2025
@emesare
Copy link
Copy Markdown
Member

emesare commented May 3, 2025

Cherry picked on dev with c925399 to cleanup some of the old TODO comments and return false on unknown platform. Thanks for the PR!

@emesare emesare closed this May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

File Format: SharedCache Issue with the dyld_shared_cache plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants