Skip to content
Permalink
Browse files

Don't accept '\08' or '\09' in strict mode (#9769)

  • Loading branch information...
danez committed Apr 2, 2019
1 parent 123fdfd commit c7587c016efa04d2497be475e00e41660203bd52
Showing with 8 additions and 5 deletions.
  1. +8 −2 packages/babel-parser/src/tokenizer/index.js
  2. +0 −3 scripts/tests/test262/test262_whitelist.txt
@@ -1213,7 +1213,13 @@ export default class Tokenizer extends LocationParser {
octalStr = octalStr.slice(0, -1);
octal = parseInt(octalStr, 8);
}
if (octal > 0) {
this.state.pos += octalStr.length - 1;
const next = this.input.charCodeAt(this.state.pos);
if (
octalStr !== "0" ||
next === charCodes.digit8 ||
next === charCodes.digit9
) {
if (inTemplate) {
this.state.invalidTemplateEscapePosition = codePos;
return null;
@@ -1226,7 +1232,7 @@ export default class Tokenizer extends LocationParser {
this.state.octalPosition = codePos;
}
}
this.state.pos += octalStr.length - 1;

return String.fromCharCode(octal);
}

@@ -409,8 +409,6 @@ language/expressions/object/method-definition/private-name-early-error-gen-insid
language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js(strict mode)
language/expressions/object/method-definition/private-name-early-error-method-inside-class.js(default)
language/expressions/object/method-definition/private-name-early-error-method-inside-class.js(strict mode)
language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js(default)
language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js(strict mode)
language/expressions/template-literal/unicode-escape-nls-err.js(default)
language/expressions/template-literal/unicode-escape-nls-err.js(strict mode)
language/identifiers/unicode-escape-nls-err.js(default)
@@ -586,7 +584,6 @@ language/literals/regexp/u-unicode-esc-non-hex.js(default)
language/literals/regexp/u-unicode-esc-non-hex.js(strict mode)
language/literals/regexp/unicode-escape-nls-err.js(default)
language/literals/regexp/unicode-escape-nls-err.js(strict mode)
language/literals/string/legacy-non-octal-escape-sequence-strict.js(strict mode)
language/literals/string/unicode-escape-nls-err-double.js(default)
language/literals/string/unicode-escape-nls-err-double.js(strict mode)
language/literals/string/unicode-escape-nls-err-single.js(default)

0 comments on commit c7587c0

Please sign in to comment.
You can’t perform that action at this time.