improve handling of invalid CLI options (#3966)
authorAlex Lam S.L <alexlamsl@gmail.com>
Mon, 8 Jun 2020 03:16:03 +0000 (04:16 +0100)
committerGitHub <noreply@github.com>
Mon, 8 Jun 2020 03:16:03 +0000 (11:16 +0800)
bin/uglifyjs

index c15acca..fcbdff6 100755 (executable)
@@ -40,6 +40,7 @@ while (args.length) {
     } else if (arg[1] == "-") {
         process_option(arg.slice(2));
     } else [].forEach.call(arg.slice(1), function(letter, index, arg) {
+        if (!(letter in short_forms)) fatal("invalid option -" + letter);
         process_option(short_forms[letter], index + 1 < arg.length);
     });
 }