diff --git a/Cargo.toml b/Cargo.toml index 4c95528..6458c52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ categories = ["api-bindings"] [dependencies] derive_builder = "0.9.0" -quick-js = "0.3.0" +quick-js = { version = "0.3.0", features = ["patched"] } thiserror = "1.0" diff --git a/src/lib.rs b/src/lib.rs index 48def63..c7593d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -519,4 +519,19 @@ mod tests { assert!(!html.contains(r#"color:#ff0000"#)); assert!(html.contains(r#"a href="https://www.google.com""#)); } + + #[test] + fn test_stack_overflow() { + #[inline(never)] + fn simulate_deep_stack(i: i32) { + if i > 0 { + simulate_deep_stack(i - 1); + } else { + let html = render("a = b + c").unwrap(); + assert!(html.contains(r#"span class="katex""#)); + } + } + simulate_deep_stack(100); + simulate_deep_stack(0); + } }