Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: undefined is not an object (evaluating 'this.yy.parser') #358

Open
waitingcheung opened this issue Aug 17, 2017 · 0 comments
Open

Comments

@waitingcheung
Copy link

I am using handlebars.js, which uses the lexer of jison in the source code. I found out that an invalid template can crash the library at the lexer generated by jison.

The following JSFiddle reproduces the error.

To fix the bug, you may change the if condition if (this.yy.parser) at line 1988 of handlebars.js to if (this.yy && this.yy.parser).

GerHobbelt added a commit to GerHobbelt/lex-parser that referenced this issue Aug 27, 2017
- cleanup: clean up the lexer condition stack better by better matching `pushState()` actions with their matching `popState()` counterparts: this is non-trivial in the current lexer grammar though...
- defensive coding: fix situations like zaach/jison#358 / handlebars-lang/handlebars.js#1368 in the spurious case where the lexer `parseError()` API is invoked *before* the `setInput()` API is invoked (which would *always* set up a non-NULL (though possibly *empty*) `this.yy` lexer context. (Original jison (https://github.com/zaach/jison) doesn't do the latter either, BTW)
GerHobbelt added a commit to GerHobbelt/jison-lex that referenced this issue Aug 27, 2017
…ng/handlebars.js#1368 in the spurious case where the lexer `parseError()` API is invoked *before* the `setInput()` API is invoked (which would *always* set up a non-NULL (though possibly *empty*) `this.yy` lexer context. (Original jison (https://github.com/zaach/jison) doesn't do the latter either, BTW)
GerHobbelt added a commit to GerHobbelt/ebnf-parser that referenced this issue Aug 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant