Skip to content

🍒 [Sanitizers][Darwin] Correct iterating of MachO load commands (#130… #10233

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

Conversation

wrotki
Copy link

@wrotki wrotki commented Mar 11, 2025

…161)

The condition to stop iterating so far was to look for load command cmd field == 0. The iteration would continue past the commands area, and would finally find lc->cmd ==0, if lucky. Or crash with bus error, if out of luck.

Correcting this by limiting the number of iterations to the count specified in mach_header(_64) ncmds field.

rdar://143903403


Co-authored-by: Mariusz Borsa [email protected]
(cherry picked from commit 62a6d63)

…#130161)

The condition to stop iterating so far was to look for load command cmd
field == 0. The iteration would continue past the commands area, and
would finally find lc->cmd ==0, if lucky. Or crash with bus error, if
out of luck.

Correcting this by limiting the number of iterations to the count
specified in mach_header(_64) ncmds field.

rdar://143903403

---------

Co-authored-by: Mariusz Borsa <[email protected]>
(cherry picked from commit 62a6d63)
@wrotki wrotki requested a review from a team as a code owner March 11, 2025 22:07
@wrotki
Copy link
Author

wrotki commented Mar 11, 2025

@swift-ci test

@wrotki wrotki merged commit 75ac807 into stable/20240723 Mar 12, 2025
3 checks passed
@wrotki wrotki deleted the eng/m_borsa/fix_sanitizers_load_commands_read_overrun_cherry_pick_stable_20240723 branch March 12, 2025 16:44
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