Skip to content

Commit

Permalink
fix: add one last check
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Sep 1, 2024
1 parent 179656b commit 2d5b276
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/dyld/prebuilt.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ func (f *File) GetLaunchLoaderSet(executablePath string) (*PrebuiltLoaderSet, er
if !f.SupportsProgramTrie() {
return nil, ErrProgramTrieNotSupported
}
if !f.SupportsDylibPrebuiltLoader() {
return nil, ErrPrebuiltLoaderSetNotSupported
}

var psetOffset uint64

Expand Down Expand Up @@ -271,7 +274,7 @@ func (f *File) parsePrebuiltLoaderSet(sr *io.SectionReader) (*PrebuiltLoaderSet,
}
pset.SelectorTable = &o
}
if pset.ObjcClassHashTableOffset > 0 {
if pset.ObjcClassHashTableOffset > 0 && !pset.Loaders[0].Loader.IsVersion2() {
sr.Seek(int64(pset.ObjcClassHashTableOffset), io.SeekStart)
var o ObjCClassOpt
if err := binary.Read(sr, f.ByteOrder, &o.objCStringTable); err != nil {
Expand Down Expand Up @@ -305,7 +308,7 @@ func (f *File) parsePrebuiltLoaderSet(sr *io.SectionReader) (*PrebuiltLoaderSet,
}
pset.ClassTable = &o
}
if pset.ObjcProtocolHashTableOffset > 0 {
if pset.ObjcProtocolHashTableOffset > 0 && !pset.Loaders[0].Loader.IsVersion2() {
sr.Seek(int64(pset.ObjcProtocolHashTableOffset), io.SeekStart)
var o ObjCClassOpt
if err := binary.Read(sr, f.ByteOrder, &o.objCStringTable); err != nil {
Expand Down

0 comments on commit 2d5b276

Please sign in to comment.