summaryrefslogtreecommitdiff
path: root/xmlschemastypes.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2006-03-09 18:41:40 +0000
committerDaniel Veillard <veillard@src.gnome.org>2006-03-09 18:41:40 +0000
commit14b5643947845df089376106517c4f7ba061e4b0 (patch)
tree7afe83d4439da85a3e31ebc5bfd621a6c750326d /xmlschemastypes.c
parent2728f845c5581af9213057ace8b3f664d64c15a9 (diff)
downloadlibxml2-14b5643947845df089376106517c4f7ba061e4b0.tar.gz
more cleanups based on coverity reports. Daniel
* relaxng.c xmlschemas.c xmlschemastypes.c: more cleanups based on coverity reports. Daniel
Diffstat (limited to 'xmlschemastypes.c')
-rw-r--r--xmlschemastypes.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 557d0ab2..987f85ff 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -237,6 +237,9 @@ xmlSchemaNewMinLengthFacet(int value)
xmlSchemaFacetPtr ret;
ret = xmlSchemaNewFacet();
+ if (ret == NULL) {
+ return(NULL);
+ }
ret->type = XML_SCHEMA_FACET_MINLENGTH;
ret->val = xmlSchemaNewValue(XML_SCHEMAS_NNINTEGER);
ret->val->value.decimal.lo = value;
@@ -1390,11 +1393,12 @@ _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
*/
static int
_xmlSchemaParseTimeZone (xmlSchemaValDatePtr dt, const xmlChar **str) {
- const xmlChar *cur = *str;
+ const xmlChar *cur;
int ret = 0;
if (str == NULL)
return -1;
+ cur = *str;
switch (*cur) {
case 0:
@@ -2386,9 +2390,6 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
const xmlChar *cur = value;
int neg = 0;
- if (cur == NULL)
- goto return1;
-
if (normOnTheFly)
while IS_WSP_BLANK_CH(*cur) cur++;
@@ -3818,6 +3819,14 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
long tyr = r->year + (long)FQUOTIENT_RANGE((int)r->mon-1, 1, 13);
if (tyr == 0)
tyr--;
+ /*
+ * Coverity detected an overrun in daysInMonth
+ * of size 12 at position 12 with index variable "((r)->mon - 1)"
+ */
+ if (tmon < 0)
+ tmon = 0;
+ if (tmon > 12)
+ tmon = 12;
tempdays += MAX_DAYINMONTH(tyr, tmon);
carry = -1;
} else if (tempdays > (long) MAX_DAYINMONTH(r->year, r->mon)) {