Skip to content

Commit

Permalink
fix: intel macOS lazy slide-info v2 parsing 'better-er'
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed May 29, 2024
1 parent 1386c7a commit b83fd1c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/ipsw/cmd/dyld/dyld_macho.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var MachoCmd = &cobra.Command{
Use: "macho <DSC> <DYLIB>",
Aliases: []string{"m"},
Short: "Parse an incache dylib file",
Args: cobra.ExactArgs(2),
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) == 1 {
return getImages(args[0]), cobra.ShellCompDirectiveDefault
Expand Down Expand Up @@ -322,7 +322,7 @@ var MachoCmd = &cobra.Command{
return fmt.Errorf("failed to dump swift data: %v", err)
}
} else {
fmt.Println(" - no swift")
fmt.Print(" - no swift")
}
println()
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,6 @@ func Parse(in string) (*Bundle, error) {
if err := binary.Read(f, binary.LittleEndian, &t4); err != nil {
return nil, fmt.Errorf("failed to read bundle type 4: %v", err)
}
for _, r := range t4.Ranges {
log.Debug(r.String())
}
bn.TypeHeader = t4
// parse device tree/config
dtreeRange := t4.Ranges[9]
Expand Down
4 changes: 3 additions & 1 deletion pkg/dyld/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ func (i CacheSlideInfo2) GetPageSize() uint32 {
return i.PageSize
}
func (i CacheSlideInfo2) SlidePointer(ptr uint64) uint64 {
if ptr > i.ValueAdd {
shift := uint64(64 - bits.LeadingZeros64(i.ValueAdd))
mask := uint64(1<<64-1) >> shift << shift
if ptr > i.ValueAdd && (ptr&mask) == 0 {
return ptr
}
if (ptr & ^i.DeltaMask) != 0 {
Expand Down

0 comments on commit b83fd1c

Please sign in to comment.