Browse Source

Limit () nesting inside urls

Allow no more than 32 levels of nesting in `[]( (((((....))))) )`
for performance reasons.

close https://github.com/markdown-it/markdown-it/issues/732
pull/745/head
Alex Kocharin 4 years ago
parent
commit
1910a3cdb2
  1. 1
      CHANGELOG.md
  2. 1
      lib/helpers/parse_link_destination.js

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [12.0.3] - WIP ## [12.0.3] - WIP
### Fixed ### Fixed
- `[](<foo<bar>)` is no longer a valid link. - `[](<foo<bar>)` is no longer a valid link.
- Fix performance issues when parsing links, #732.
## [12.0.2] - 2020-10-23 ## [12.0.2] - 2020-10-23

1
lib/helpers/parse_link_destination.js

@ -59,6 +59,7 @@ module.exports = function parseLinkDestination(str, pos, max) {
if (code === 0x28 /* ( */) { if (code === 0x28 /* ( */) {
level++; level++;
if (level > 32) { return result; }
} }
if (code === 0x29 /* ) */) { if (code === 0x29 /* ) */) {

Loading…
Cancel
Save