Skip to content

Commit

Permalink
fix(lockfile): prevent infinite loop
Browse files Browse the repository at this point in the history
Fix bug where yarn could get into an infinite loop when parsing a corrupted lockfile with an
unterminated string.
  • Loading branch information
rhendric authored and Gudahtt committed Oct 11, 2018
1 parent 800b266 commit b7cd239
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa

## Master

- Prevent infinite loop when parsing corrupted lockfile with unterminated string

[#4965](https://github.com/yarnpkg/yarn/pull/4965) - [**Ryan Hendrickson**](https://github.com/rhendric)

- Environment variables now have to **start** with `YARN_` (instead of just contain it) to be considered

[#6518](https://github.com/yarnpkg/yarn/pull/6518) - [**Michael Gmelin**](https://blog.grem.de)
Expand Down
2 changes: 1 addition & 1 deletion src/lockfile/parse.js
Expand Up @@ -94,7 +94,7 @@ function* tokenise(input: string): Iterator<Token> {
}
} else if (input[0] === '"') {
let i = 1;
for (; ; i++) {
for (; i < input.length; i++) {
if (input[i] === '"') {
const isEscaped = input[i - 1] === '\\' && input[i - 2] !== '\\';
if (!isEscaped) {
Expand Down

0 comments on commit b7cd239

Please sign in to comment.