mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
fixing an out of bound adressing issue Daniel
* xmlschemastypes.c: fixing an out of bound adressing issue Daniel
This commit is contained in:
parent
079f6a7559
commit
49e8963c64
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user