Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NSRangeException when removing load command #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BarakAharoni
Copy link

Fix exception when removing load command by validate name's range offset is in binary bounds.

Reproduce: ./optool uninstall -c load -p "{path_to_lc}"-t {target_binary}

Found thin header...
removing payload from LC_LOAD_UPWARD_DYLIB...
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSConcreteMutableData subdataWithRange:]: range {1601335516, 33359580} exceeds data length 93552'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff815ba185e __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff81569467f objc_exception_throw + 48
2 Foundation 0x00007ff816a18a53 -[NSProgress initWithParent:userInfo:] + 0
3 optool 0x0000000102afe11c removeLoadEntryFromBinary + 389
4 optool 0x0000000102afce22 main + 2679
5 dyld 0x0000000202e7f386 start + 1942
)
libc++abi: terminating due to uncaught exception of type NSException
[1] 57846 abort ./optool uninstall -c load -p "{path_to_lc}" -t

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