mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Fix an instance of "Polynomial regular expression used on uncontrolled data".
This commit is contained in:
parent
a4c4e198d6
commit
b6121341b9
2 changed files with 2 additions and 2 deletions
|
|
@ -2979,7 +2979,7 @@ module.exports = {
|
||||||
var trailingPunctuationRe = new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
|
var trailingPunctuationRe = new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
|
||||||
forEachHeading(params, function (heading) {
|
forEachHeading(params, function (heading) {
|
||||||
var line = heading.line, lineNumber = heading.lineNumber;
|
var line = heading.line, lineNumber = heading.lineNumber;
|
||||||
var trimmedLine = line.replace(/[\s#]*$/, "");
|
var trimmedLine = line.replace(/([^\s#])[\s#]+$/, "$1");
|
||||||
var match = trailingPunctuationRe.exec(trimmedLine);
|
var match = trailingPunctuationRe.exec(trimmedLine);
|
||||||
if (match && !endOfLineHtmlEntityRe.test(trimmedLine)) {
|
if (match && !endOfLineHtmlEntityRe.test(trimmedLine)) {
|
||||||
var fullMatch = match[0];
|
var fullMatch = match[0];
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ module.exports = {
|
||||||
new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
|
new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
|
||||||
forEachHeading(params, (heading) => {
|
forEachHeading(params, (heading) => {
|
||||||
const { line, lineNumber } = heading;
|
const { line, lineNumber } = heading;
|
||||||
const trimmedLine = line.replace(/[\s#]*$/, "");
|
const trimmedLine = line.replace(/([^\s#])[\s#]+$/, "$1");
|
||||||
const match = trailingPunctuationRe.exec(trimmedLine);
|
const match = trailingPunctuationRe.exec(trimmedLine);
|
||||||
if (match && !endOfLineHtmlEntityRe.test(trimmedLine)) {
|
if (match && !endOfLineHtmlEntityRe.test(trimmedLine)) {
|
||||||
const fullMatch = match[0];
|
const fullMatch = match[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue