History

fix: another fuzz-issue that could cause long parse times of URLs

Sebastian Thiel committed 3 years ago

Commit ea0ea881 parent ac1d8d43 files · +1 −0Browse files

Unified · Split

3 files
  1. gix-url/src/parse.rs +1 −0
  2. gix-url/tests/fixtures/fuzzed/very-long4.url +0 −0
  3. gix-url/tests/parse/mod.rs +1 −1
gix-url/src/parse.rs+1−0
@@ -86,6 +86,7 @@ pub(crate) fn url(input: &BStr, protocol_end: usize) -> Result<crate::Url, Error · 85 unmodified lines
8686 const MAX_LEN: usize = 1024;
8787 let bytes_to_path = input[protocol_end + "://".len()..]
8888 .iter()
89+ .filter(|b| !b.is_ascii_whitespace())
8990 .skip_while(|b| **b == b'/')
9091 .position(|b| *b == b'/')
9192 .unwrap_or(input.len() - protocol_end);
gix-url/tests/fixtures/fuzzed/very-long4.url+0−0

Binary file not shown.

gix-url/tests/parse/mod.rs+1−1
@@ -139,7 +139,7 @@ mod unknown { · 138 unmodified lines
139139
140140 #[test]
141141 fn fuzzed() {
142− for name in ["very-long", "very-long2", "very-long3"] {
142+ for name in ["very-long4", "very-long3", "very-long2", "very-long"] {
143143 let base = Path::new("tests").join("fixtures").join("fuzzed");
144144 let location = base.join(Path::new(name).with_extension("url"));
145145 let url = std::fs::read(&location).unwrap();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t