aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/event.rs7
-rw-r--r--tests/fuzz.rs24
2 files changed, 29 insertions, 2 deletions
diff --git a/src/event.rs b/src/event.rs
index a63a475..35eaa74 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -3512,8 +3512,11 @@ impl Point {
b'\n' | b'\r' => unreachable!("cannot move past line endings"),
b'\t' => {
let remainder = next.column % TAB_SIZE;
- debug_assert_ne!(remainder, 0, "expected remainder larger than `0`");
- let vs = TAB_SIZE - remainder;
+ let vs = if remainder == 0 {
+ 0
+ } else {
+ TAB_SIZE - remainder
+ };
next.index += 1;
next.column += 1 + vs;
}
diff --git a/tests/fuzz.rs b/tests/fuzz.rs
index 1e80701..54b4f40 100644
--- a/tests/fuzz.rs
+++ b/tests/fuzz.rs
@@ -74,5 +74,29 @@ fn fuzz() -> Result<(), String> {
"7: lazy container lines almost starting fenced code (GH-19)"
);
+ assert_eq!(
+ to_html_with_options("a\tb@c.d", &Options::gfm()),
+ Ok("<p>a\t<a href=\"mailto:b@c.d\">b@c.d</a></p>".into()),
+ "8-a: autolink literals after tabs (GH-18)"
+ );
+
+ assert_eq!(
+ to_html_with_options("aa\tb@c.d", &Options::gfm()),
+ Ok("<p>aa\t<a href=\"mailto:b@c.d\">b@c.d</a></p>".into()),
+ "8-b: autolink literals after tabs (GH-18)"
+ );
+
+ assert_eq!(
+ to_html_with_options("aaa\tb@c.d", &Options::gfm()),
+ Ok("<p>aaa\t<a href=\"mailto:b@c.d\">b@c.d</a></p>".into()),
+ "8-c: autolink literals after tabs (GH-18)"
+ );
+
+ assert_eq!(
+ to_html_with_options("aaaa\tb@c.d", &Options::gfm()),
+ Ok("<p>aaaa\t<a href=\"mailto:b@c.d\">b@c.d</a></p>".into()),
+ "8-d: autolink literals after tabs (GH-18)"
+ );
+
Ok(())
}