Skip to content

Commit 52f2d41

Browse files
committed
Add a stack overflow test for nested block.
1 parent ee735e8 commit 52f2d41

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,18 @@ fn unquoted_url(b: &mut Bencher) {
603603

604604
struct JsonParser;
605605

606+
#[test]
607+
fn no_stack_overflow_multiple_nested_blocks() {
608+
let mut input: String = "{{".into();
609+
for _ in 0..30 {
610+
let dup = input.clone();
611+
input.push_str(&dup);
612+
}
613+
let mut input = Parser::new(&input);
614+
while !input.is_exhausted() {
615+
input.next().expect("What?");
616+
}
617+
}
606618

607619
impl DeclarationParser for JsonParser {
608620
type Declaration = Json;

0 commit comments

Comments
 (0)