Commit 49e8963c authored by Daniel Veillard's avatar Daniel Veillard
Browse files

fixing an out of bound adressing issue Daniel

* xmlschemastypes.c: fixing an out of bound adressing issue
Daniel
parent 079f6a75
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
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment