sandygao 2003/03/25 06:47:06
Modified: java/src/org/apache/xerces/impl/xpath/regex
message.properties RegexParser.java
Log:
Fixing bugs 17415: Regexes with large min/max not handled correctly.
Many thanks to Khaled Noaman for the patch.
Revision Changes Path
1.6 +1 -0
xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/message.properties
Index: message.properties
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/message.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- message.properties 24 Mar 2003 23:37:55 -0000 1.5
+++ message.properties 25 Mar 2003 14:47:06 -0000 1.6
@@ -36,3 +36,4 @@
parser.quantifier.2=Invalid quantifier. Invalid quantity or a '}' is missing.
parser.quantifier.3=Invalid quantifier. A digit or '}' is expected.
parser.quantifier.4=Invalid quantifier. A min quantity must be <= a max quantity.
+parser.quantifier.5=Invalid quantifier. A quantity value overflow.
1.8 +5 -1
xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegexParser.java
Index: RegexParser.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegexParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RegexParser.java 24 Mar 2003 23:31:04 -0000 1.7
+++ RegexParser.java 25 Mar 2003 14:47:06 -0000 1.8
@@ -653,6 +653,8 @@
while (off < this.regexlen
&& (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') {
min = min*10 +ch-'0';
+ if (min < 0)
+ throw ex("parser.quantifier.5", this.offset);
}
}
else {
@@ -672,6 +674,8 @@
&& (ch = this.regex.charAt(off++)) >= '0'
&& ch <= '9') {
max = max*10 +ch-'0';
+ if (max < 0)
+ throw ex("parser.quantifier.5", this.offset);
}
if (min > max)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]