summaryrefslogtreecommitdiff
path: root/xmlschemastypes.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2008-04-03 10:43:52 +0000
committerDaniel Veillard <veillard@src.gnome.org>2008-04-03 10:43:52 +0000
commitbfc42632b70ed24deacc04152c880bcc82f60a96 (patch)
tree23298d9c3808dfbaec44527147092c727ae01cbd /xmlschemastypes.c
parentf124539f7abb8be0d4797ede3d207c77c68c97da (diff)
downloadlibxml2-bfc42632b70ed24deacc04152c880bcc82f60a96.tar.gz
horror around the definition of the lexical values for decimal and derived
* xmlschemastypes.c: horror around the definition of the lexical values for decimal and derived types, fixing to reject empty values, should fix #503268 Daniel svn path=/trunk/; revision=3728
Diffstat (limited to 'xmlschemastypes.c')
-rw-r--r--xmlschemastypes.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index a35c5396..0d967d07 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -2063,7 +2063,7 @@ xmlSchemaValAtomicListNode(xmlSchemaTypePtr type, const xmlChar *value,
* Parse an unsigned long into 3 fields.
*
* Returns the number of significant digits in the number or
- * -1 if overflow of the capacity
+ * -1 if overflow of the capacity and -2 if it's not a number.
*/
static int
xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo,
@@ -2072,6 +2072,9 @@ xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo,
const xmlChar *tmp, *cur = *str;
int ret = 0, i = 0;
+ if (!((*cur >= '0') && (*cur <= '9')))
+ return(-2);
+
while (*cur == '0') { /* ignore leading zeroes */
cur++;
}
@@ -2342,9 +2345,9 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
* Terminate the (preparsed) string.
*/
if (len != 0) {
- *cptr = 0;
+ *cptr = 0;
cptr = cval;
-
+
xmlSchemaParseUInt((const xmlChar **)&cptr,
&v->value.decimal.lo,
&v->value.decimal.mi,
@@ -3116,7 +3119,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
} else if (*cur == '+')
cur++;
ret = xmlSchemaParseUInt(&cur, &lo, &mi, &hi);
- if (ret == -1)
+ if (ret < 0)
goto return1;
if (normOnTheFly)
while IS_WSP_BLANK_CH(*cur) cur++;
@@ -3161,7 +3164,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
case XML_SCHEMAS_BYTE:
case XML_SCHEMAS_SHORT:
case XML_SCHEMAS_INT:{
- const xmlChar *cur = value;
+ const xmlChar *cur = value;
unsigned long lo, mi, hi;
int sign = 0;