shapesecurity / shift-scope-js

scope analyser for the Shift AST
http://shift-ast.org/scope.html
Apache License 2.0
11 stars 6 forks source link

Scope unconditionally checks for's init type, even though it could be null. #21

Closed tolmasky closed 9 years ago

tolmasky commented 9 years ago

for(; index < count; ++index) { } <-- crash

line 83 is:

if ( node.init.type === "VariableDeclaration" && init.blockScopedDeclarations.size > 0) {

should be:

if (node.init && node.init.type === "VariableDeclaration" && init.blockScopedDeclarations.size > 0) {
michaelficarra commented 9 years ago

Thanks, @tolmasky! I'll take a look at this today.