Skip to content

Commit c486cf8

Browse files
author
Ashe Connor
authored
Merge pull request #35 from SSJohns/fuzz
Fix for inter-unicode slices and indexing
2 parents bbcdf97 + b68482c commit c486cf8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/parser/autolink.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn www_match<'a>(
7575
return None;
7676
}
7777

78-
if contents.len() - i < 4 || &contents[i..i + 4] != "www." {
78+
if !contents[i..].starts_with("www.") {
7979
return None;
8080
}
8181

src/parser/inlines.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl<'a, 'r, 'o, 'd, 'i> Subject<'a, 'r, 'o, 'd, 'i> {
720720
};
721721
let endall = endtitle + scanners::spacechars(&self.input[endtitle..]).unwrap_or(0);
722722

723-
if self.input.as_bytes()[endall] == b')' {
723+
if endall < self.input.len() && self.input.as_bytes()[endall] == b')' {
724724
self.pos = endall + 1;
725725
let url = strings::clean_url(&self.input[starturl..endurl]);
726726
let title = strings::clean_title(&self.input[starttitle..endtitle]);

0 commit comments

Comments
 (0)