fixing an out of bound adressing issue Daniel

* xmlschemastypes.c: fixing an out of bound adressing issue
Daniel
This commit is contained in:
Daniel Veillard 2004-09-23 16:24:36 +00:00
parent 079f6a7559
commit 49e8963c64
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,7 @@
Thu Sep 23 18:23:46 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmlschemastypes.c: fixing an out of bound adressing issue
Thu Sep 23 15:14:12 CEST 2004 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c parser.c relaxng.c xmlschemas.c: more memory related

View File

@ -3128,17 +3128,21 @@ static long
_xmlSchemaDateCastYMToDays (const xmlSchemaValPtr dt)
{
long ret;
int mon;
if (dt->value.date.year < 0)
mon = dt->value.date.mon;
if (mon <= 0) mon = 1; /* normalization */
if (dt->value.date.year <= 0)
ret = (dt->value.date.year * 365) +
(((dt->value.date.year+1)/4)-((dt->value.date.year+1)/100)+
((dt->value.date.year+1)/400)) +
DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year);
DAY_IN_YEAR(0, mon, dt->value.date.year);
else
ret = ((dt->value.date.year-1) * 365) +
(((dt->value.date.year-1)/4)-((dt->value.date.year-1)/100)+
((dt->value.date.year-1)/400)) +
DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year);
DAY_IN_YEAR(0, mon, dt->value.date.year);
return ret;
}