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

Use checked_add in frame_to_pointer #290

Open
phil-opp opened this issue Aug 9, 2021 · 0 comments
Open

Use checked_add in frame_to_pointer #290

phil-opp opened this issue Aug 9, 2021 · 0 comments

Comments

@phil-opp
Copy link
Member

phil-opp commented Aug 9, 2021

Here:

let virt = self.offset + frame.start_address().as_u64();

The physical address space is larger than the virtual one, so this can overflow on some architectures (e.g. see #289). It can also overflow when offset is large. Rust doesn't do overflow checking in release mode by default, so we should use checked_add here to ensure that an overflow always leads to a panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant