Skip to content

Bug: redefining NaN in finally (?) #1695

@pvdz

Description

@pvdz
  • Bug report or feature request?
    Bug. Found by fuzzer. Clearly.
    Potentially an ES6 scope issue.

  • uglify-js version (uglifyjs -V)
    Git master, just pulled before submitting.

This one was a little odd because I couldn't repro it from the originally constructed source, but I could from its own minified output. Eh, whatever. I don't really know what's actually going on here but removing any piece of the remaining code makes the bug disappear. Renaming the var does too.

var a = 0;
var i = 5;
do {
  try {
  } finally {
    var NaN = --a;
  }
} while (NaN && --i > 0)
console.log(a);
$ bin/uglifyjs s.js -c
var a=0,i=5;do{try{}finally{var NaN=--a}}while(NaN&&--i>0);console.log(a);
$ node s.js && bin/uglifyjs s.js -c | node
-5
-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions