jquery / jquery/esprima

Identifier with \u{xxxx} doesn't make validation

Open
#1,985 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
772
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce
es.parse('a\\u{0022}b=1')
Expected output

pares error

Actual output
{
    "type": "Program",
    "body": [
        {
            "type": "ExpressionStatement",
            "expression": {
                "type": "AssignmentExpression",
                "operator": "=",
                "left": {
                    "type": "Identifier",
                    "name": "a\"b"
                },
                "right": {
                    "type": "Literal",
                    "value": 1,
                    "raw": "1"
                }
            }
        }
    ],
    "sourceType": "script"
}
Problem location

scanner.ts:462(getComplexIdentifier)
scanner.ts:490(getComplexIdentifier)

Relevant references

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in scanner.ts at getComplexIdentifier around lines 462 and 490, then reproduce the issue with es.parse('a\u{0022}b=1'). The work is done when this invalid identifier produces a parse error instead of an AST containing the decoded name a"b.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.