conventional-commits-parser 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -37,6 +37,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
37
37
 
38
38
 
39
39
 
40
+ ### [3.2.3](https://www.github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser-v3.2.2...conventional-commits-parser-v3.2.3) (2021-10-23)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * address ReDoS issue ([#861](https://www.github.com/conventional-changelog/conventional-changelog/issues/861)) ([c696fa3](https://www.github.com/conventional-changelog/conventional-changelog/commit/c696fa35f93e0ee13728d6cf1221587ac6386311))
46
+
40
47
  ### [3.2.2](https://www.github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser-v3.2.1...conventional-commits-parser-v3.2.2) (2021-09-09)
41
48
 
42
49
 
package/lib/parser.js CHANGED
@@ -5,7 +5,16 @@ const CATCH_ALL = /()(.+)/gi
5
5
  const SCISSOR = '# ------------------------ >8 ------------------------'
6
6
 
7
7
  function trimOffNewlines (input) {
8
- return input.replace(/^(?:\r|\n)+|(?:\r|\n)+$/g, '')
8
+ const result = input.match(/[^\r\n]/)
9
+ if (!result) {
10
+ return ''
11
+ }
12
+ const firstIndex = result.index
13
+ let lastIndex = input.length - 1
14
+ while (input[lastIndex] === '\r' || input[lastIndex] === '\n') {
15
+ lastIndex--
16
+ }
17
+ return input.substring(firstIndex, lastIndex + 1)
9
18
  }
10
19
 
11
20
  function append (src, line) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conventional-commits-parser",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "Parse raw conventional commits",
5
5
  "bugs": {
6
6
  "url": "https://github.com/conventional-changelog/conventional-changelog/issues"