Skip to content

Filter fallback Mach-O candidates to exclude runtime dylibs - #97

Merged
Lessica merged 3 commits into
mainfrom
copilot/apply-feedback-from-pull-96
Apr 13, 2026
Merged

Filter fallback Mach-O candidates to exclude runtime dylibs#97
Lessica merged 3 commits into
mainfrom
copilot/apply-feedback-from-pull-96

Conversation

CopilotAI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

The dlopen fallback path added in #96 uses all Mach-Os found under Frameworks/ as candidates, bypassing the filtering that resolveLoadCommand normally applies (which ignores @rpath/libswift*). This can cause the injector to select a Swift runtime dylib as the injection target.

  • Filter allMachOsInFrameworks in the fallback branch to exclude libswift* and ignoredDylibAndFrameworkNames entries before sorting/selection
letfilteredMachOs= allMachOsInFrameworks.filter{ url inletnameLower= url.lastPathComponent.lowercased()if nameLower.hasPrefix("libswift"){returnfalse}ifSelf.ignoredDylibAndFrameworkNames.contains(nameLower){returnfalse}returntrue}

@Lessica
Lessica marked this pull request as ready for review April 13, 2026 06:35
CopilotAI review requested due to automatic review settings April 13, 2026 06:35

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents the dlopen-based fallback Mach-O selection (added for Unity apps) from accidentally choosing Swift runtime dylibs as injection targets by applying the same “ignore” filtering used elsewhere in Mach-O resolution.

Changes:

  • Filters the fallback Frameworks/ Mach-O candidate list to exclude libswift* dylibs.
  • Also filters out entries listed in ignoredDylibAndFrameworkNames before sorting/selection.
  • Updates fallback logging to report filtered vs excluded candidate counts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadTrollFools/InjectorV3+Bundle.swift Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Lessica
Lessica merged commit 8c99e3d into mainApr 13, 2026
1 check passed
@Lessica
Lessica deleted the copilot/apply-feedback-from-pull-96 branch April 13, 2026 07:08
Sign up for freeto 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.

3 participants

@Lessica