fix(headers): prevent 2 panics in QualityItem parsing

1. index out of bounds if semicolon is the last character
2. not a char boundary on non-ASCII input (only allow ASCII now)

Bugs found using `cargo fuzz`
This commit is contained in:
Pyfisch
2017-03-05 12:26:19 +01:00
parent c51a9993fa
commit d80aae55b1
2 changed files with 18 additions and 0 deletions

View File

@@ -114,6 +114,11 @@ header! {
SubLevel::Plain, vec![(Attr::Charset, Value::Utf8)]),
Quality(500)),
])));
test_header!(
test_fuzzing1,
vec![b"chunk#;e"],
None
);
}
}