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

Bug: Overflow of read/writeptr #140

Open
ThoreMehr opened this issue Jan 25, 2025 · 1 comment
Open

Bug: Overflow of read/writeptr #140

ThoreMehr opened this issue Jan 25, 2025 · 1 comment

Comments

@ThoreMehr
Copy link

I think behaviour depends on the platform. At least on mine when usize overflows it wraps. As len() is defined with the difference of those pointers if one wraps and the other not the difference will be large and wrong.
I think to solve that one would have to track length independently or do something smart with those pointers in case of warping.

@jdonszelmann
Copy link
Collaborator

The behavior doesn't depend on the platform, we use non-wrapping integers so on overflow we panic in debug mode and technically UB in release mode. On 64 bit platforms, overflows are unlikely to ever happen but you're not wrong that since on 32 bit platforms usize becomes 32 bit, overflows are imaginable. @NULLx76 we could change to u64, or at a very low periodicity scale the pointers down to keep them in range over time.

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

No branches or pull requests

2 participants