From 641e904074538ef985767e2397af07b78a169821 Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Thu, 26 Jan 2023 21:28:51 +0100 Subject: [PATCH] inline: disallow containers of zero length --- src/inline.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/inline.rs b/src/inline.rs index 81e01ff..058a989 100644 --- a/src/inline.rs +++ b/src/inline.rs @@ -404,6 +404,10 @@ impl + Clone> Parser { let (d, e) = self.openers[o]; let e_attr = e; let e_opener = e + 1; + if e_opener == self.events.len() - 1 { + // empty container + return None; + } let inner_span = Span::new(self.events[e_opener].span.end(), self.span.start()); let mut event_closer = match Container::try_from(d) { Ok(cont) => {