shithub: libmujs

Download patch

ref: 2e196dd0fc7344c175c9bdca79388acdfa1c15a2
parent: bc845cbd64a80429e0785dd4d28bed56561fdbe0
author: Tor Andersson <tor.andersson@artifex.com>
date: Wed Sep 24 10:05:59 EDT 2014

Strip backslash from escaped / when lexing regular expressions.

--- a/jslex.c
+++ b/jslex.c
@@ -464,11 +464,15 @@
 		if (PEEK == 0 || PEEK == '\n') {
 			jsY_error(J, "regular expression not terminated");
 		} else if (ACCEPT('\\')) {
-			textpush(J, '\\');
-			if (PEEK == 0 || PEEK == '\n')
-				jsY_error(J, "regular expression not terminated");
-			textpush(J, PEEK);
-			NEXT();
+			if (ACCEPT('/')) {
+				textpush(J, '/');
+			} else {
+				textpush(J, '\\');
+				if (PEEK == 0 || PEEK == '\n')
+					jsY_error(J, "regular expression not terminated");
+				textpush(J, PEEK);
+				NEXT();
+			}
 		} else {
 			textpush(J, PEEK);
 			NEXT();