From 7ab09c64325ef61f33c931f52180b353bdce25eb Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Sat, 20 Jul 2024 12:00:50 -0400 Subject: [PATCH] fix unclosed block comment infinite loop --- public/scripts/slash-commands/SlashCommandParser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/scripts/slash-commands/SlashCommandParser.js b/public/scripts/slash-commands/SlashCommandParser.js index 75e8f5f1a..892ac2c26 100644 --- a/public/scripts/slash-commands/SlashCommandParser.js +++ b/public/scripts/slash-commands/SlashCommandParser.js @@ -797,7 +797,12 @@ export class SlashCommandParser { return this.testSymbol(/\/\*/); } testBlockCommentEnd() { - return this.testSymbol(/\*\|/); + if (!this.verifyCommandNames) { + if (this.index >= this.text.length) return true; + } else { + if (this.ahead.length < 1) throw new SlashCommandParserError(`Unclosed block comment at position ${this.userIndex}`, this.text, this.index); + } + return this.testSymbol('*|'); } parseBlockComment() { const start = this.index + 1;