Multiple panics caused by malformed inputs
- Dominant language
- Rust
- Stars
- 943
- Forks
- 109
- Avg merge
- 8d 3h
- Merged PRs (30d)
- 1
Description
Multiple runtime panics can be triggerred by constructing malformed data structures or function arguments. I believe the API design can be improve the get rid of these problems.
Examples:
```rust
use brotli::enc::command::BrotliDistanceParams;
use brotli::enc::command::Command;
fn main() {
let mut command = Command::default();
command.dist_prefix_ = 1000;
let params = BrotliDistanceParams {
distance_postfix_bits: 40,
num_direct_distance_codes: 0,
alphabet_size: 0,
max_distance: 0,
};
let _ = brotli::enc::command::CommandRestoreDistanceCode(&command, ¶ms);
}
```
```rust
use brotli::enc::command::PrefixEncodeCopyDistance;
fn main() {
let mut code = 0;
let mut extra_bits = 0;
PrefixEncodeCopyDistance(100, 0, 100, &mut code, &mut extra_bits);
}
```
```rust
use brotli::enc::brotli_bit_stream::BrotliBuildAndStoreHuffmanTreeFast;
use brotli::enc::writer::StandardAlloc;
fn main() {
let mut alloc = StandardAlloc::default();
BrotliBuildAndStoreHuffmanTreeFast(
&mut alloc,
&[0],
0,
0,
&mut [0],
&mut [0],
&mut 99999,
&mut [0],
);
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the three Rust examples and inspect CommandRestoreDistanceCode, PrefixEncodeCopyDistance, and BrotliBuildAndStoreHuffmanTreeFast. Determine the intended behavior for malformed structures and arguments; done means these inputs no longer cause runtime panics and the API behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100