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 e4ad2a5
Showing 1 changed file with 1 addition and 1 deletion.
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 e4ad2a5

Please sign in to comment.