-
Notifications
You must be signed in to change notification settings - Fork 142
Iterating over a PageRangeInclusive can cause panic #346
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
Comments
Had a bit of time to look this over, and I think that it's related to this: x86_64/src/structures/paging/page.rs Line 355 in a143355
I suspect that because I'm trying to iterate over pages close to the top of the address range, the code here is breaking because it adds 1 to the page regardless of whether or not that is possible. Not sure of the best fix though. Could add a check to only add 1 to |
This is a bug, what you're trying to do here should work.
I completely agree with your analysis.
I think that would make the iterator yield the last address forever. I'm not too sure how to fix this either though. Rust's We could check whether Unrelated to the actual bug, but perhaps still useful for you: |
Yeah, you're right. I didn't spot that at first. I'm also struggling to think of a good way to fix this. Adding a field is probably the best way, but is a breaking change. I wouldn't really call decrementing |
A possible solution could be to add a By decreasing |
Given that it's not entirely certain that |
Closed by #351 |
I encountered what seems to be a bug (not certain though) while trying to iterate over a range of pages to count how many there are. Example code:
This panics after printing out 63 iterations:
panicked at 'attempt to add with overflow', /home/user/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc6299db9ec823/x86_64-0.14.8/src/addr.rs:257:23
. It's possible I'm doing something wrong here of course, but I'm having a hard time spotting it if so.The text was updated successfully, but these errors were encountered: