Skip to content

link.MachO.UnwindInfo: Handle u24 overflow for CU records pointing to DWARF. #23011

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

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Feb 25, 2025

@alexrp alexrp requested a review from andrewrk February 25, 2025 07:12
@alexrp alexrp added this to the 0.14.0 milestone Feb 25, 2025
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for figuring it out!

Based on this comment, wouldn't saturation be better than zero? If that's not the case, the comment should explain why that's not the case.

Edit: the LLVM comment answers the question. How about copy pasting their comment instead of this new one?

@andrewrk andrewrk merged commit e902c23 into ziglang:master Feb 25, 2025
0 of 9 checks passed
@alexrp alexrp deleted the macho-cu-intcast branch February 26, 2025 17:17
// just encode zero -- the start of the section is always the start
// of a CFI record.
const hint = std.math.cast(u24, fde.out_offset) orelse 0;
rec.enc.setDwarfSectionOffset(hint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find! Is there a test case demonstrating the issue in action I wonder?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have an easy test case, but the following PRs hit it at various points: #21498, #22605, #22488

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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.

panic: integer cast truncated bits in MachO.UnwindInfo.generate
3 participants