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

write_int never panics on out of range input #205

Open
fintelia opened this issue Apr 2, 2024 · 0 comments
Open

write_int never panics on out of range input #205

fintelia opened this issue Apr 2, 2024 · 0 comments

Comments

@fintelia
Copy link
Contributor

fintelia commented Apr 2, 2024

The documentation for ByteOrder::write_int says:

If n is not representable in nbytes, or if nbytes is > 8, then this method panics.

However, passing inputs that fail the first condition doesn't actually cause a panic:

BigEndian::write_int(&mut [0; 8], 99999999, 1); // Doesn't panic
BigEndian::write_int(&mut [0; 8], -99999999, 1); // Also doesn't panic
@fintelia fintelia changed the title write_int never panics write_int never panics on out of range input Apr 2, 2024
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

1 participant