[Pkg-javascript-commits] [uglifyjs] 05/190: Give a good error message if an invalid regular expression is found.

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Aug 7 23:17:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag upstream/2.7.0
in repository uglifyjs.

commit d6814050dd42298abb02e3fee2856174e02f01fa
Author: Chris Cowan <agentme49 at gmail.com>
Date:   Thu May 14 12:03:54 2015 -0700

    Give a good error message if an invalid regular expression is found.
---
 lib/parse.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/parse.js b/lib/parse.js
index e65c4fa..70ee2e8 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -480,7 +480,13 @@ function tokenizer($TEXT, filename, html5_comments) {
             regexp += ch;
         }
         var mods = read_name();
-        return token("regexp", new RegExp(regexp, mods));
+        var r;
+        try {
+          r = new RegExp(regexp, mods);
+        } catch(e) {
+          parse_error("Invalid regular expression");
+        }
+        return token("regexp", r);
     });
 
     function read_operator(prefix) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list