Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@p-x9
Copy link
Owner

@p-x9 p-x9 commented Oct 17, 2025

No description provided.

p-x9 added 2 commits October 18, 2025 01:53
- Clarify conversion of raw VM addresses to file offsets
- Detail handling of PAC and Objective-C tagged pointers
- Note behavior for dyld shared cache scenarios
@p-x9 p-x9 requested a review from Copilot October 17, 2025 17:04
Copy link
Contributor

Copilot AI left a comment

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 fixes the fileOffset calculation for Mach-O files contained in dyld cache by modifying how virtual memory addresses are converted to file offsets. The key change is that fileOffset(of:) now returns an optional value and properly handles cases where addresses don't exist within the current file, particularly for dyld shared cache scenarios.

  • Updated fileOffset(of:) method to return nil when addresses cannot be resolved to the current file
  • Renamed stringOffset to stringAddress in CFString protocol for clarity
  • Added proper handling for dyld shared cache file offset resolution

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Sources/MachOKit/Model/CoreFoundation/CFString.swift Renamed stringOffset to stringAddress, updated string extraction logic to handle optional file offsets, and added deprecated property for backward compatibility
Sources/MachOKit/MachOFile.swift Modified fileOffset(of:) to return optional and handle dyld cache scenarios, updated classic binding symbols to handle nil file offsets

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@p-x9 p-x9 merged commit fb225e3 into main Oct 19, 2025
2 checks passed
@p-x9 p-x9 deleted the feature/mach-o-fileoffset-in-cache branch October 19, 2025 14:50
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