Explorar o código

2002-11-06 Gonzalo Paniagua Javier <[email protected]>

	* parser.cs: detect illegal \ at end of pattern. Fixes 31334.

svn path=/trunk/mcs/; revision=8854
Gonzalo Paniagua Javier %!s(int64=23) %!d(string=hai) anos
pai
achega
99ed672e31

+ 4 - 0
mcs/class/System/System.Text.RegularExpressions/ChangeLog

@@ -1,3 +1,7 @@
+2002-11-06  Gonzalo Paniagua Javier <[email protected]>
+
+	* parser.cs: detect illegal \ at end of pattern. Fixes 31334.
+
 2002-10-25  Gonzalo Paniagua Javier <[email protected]>
 
 	* parser.cs: applied fix from Tim Haynes ([email protected]) to

+ 5 - 0
mcs/class/System/System.Text.RegularExpressions/parser.cs

@@ -874,6 +874,11 @@ namespace System.Text.RegularExpressions.Syntax {
 			int p = ptr;
 			int c;
 
+			if (p >= pattern.Length)
+				throw new ArgumentException (
+						String.Format ("Parsing \"{0}\" - Illegal \\ at end of " + 
+								"pattern.", pattern), pattern);
+			
 			switch (pattern[ptr ++]) {
 	
 			// standard escapes (except \b)