BurntSushi / BurntSushi/byteorder
write_int never panics on out of range input
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
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:
```rust
BigEndian::write_int(&mut [0; 8], 99999999, 1); // Doesn't panic
BigEndian::write_int(&mut [0; 8], -99999999, 1); // Also doesn't panic
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the ByteOrder::write_int entry point and compare its documented panic conditions with the two out-of-range examples in the issue. Reproduce both cases, then resolve the mismatch between the documented behavior and observed behavior and add coverage showing the intended result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100