From 091e3652355c8056cb53de0b1f796a7ff2aba6bf Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 21 Dec 2023 14:44:44 -0600 Subject: [PATCH] fix: bail out of readUnclosedTag early --- internal/token.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/token.go b/internal/token.go index 6c1ec6b86..5a58e1f79 100644 --- a/internal/token.go +++ b/internal/token.go @@ -1251,10 +1251,11 @@ func (z *Tokenizer) readUnclosedTag() bool { if close != -1 && len(buf) < close { buf = buf[0:close] } - } - close = bytes.Index(buf, []byte{'>'}) - if close != -1 && len(buf) < close { - buf = buf[0:close] + } else { + close = bytes.Index(buf, []byte{'>'}) + if close != -1 && len(buf) < close { + buf = buf[0:close] + } } if close == -1 { // We can't find a closing tag...