1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-12 16:58:16 +03:00

Check for tmon in _xmlSchemaDateAdd() is incorrect

For https://bugzilla.gnome.org/show_bug.cgi?id=732705
In _xmlSchemaDateAdd(), the check for |tmon| should be the following
since MAX_DAYINMONTH() expects a month in the range [1,12]:

    if (tmon < 1)
	tmon = 1;

Regression introduced in
https://git.gnome.org/browse/libxml2/commit/?id=14b5643947845df089376106517c4f7ba061e4b0
This commit is contained in:
David Kilzer 2014-07-14 22:29:56 +08:00 committed by Daniel Veillard
parent e036cb3160
commit 30cf439efc

View File

@ -3848,8 +3848,8 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
* 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 < 1)
tmon = 1;
if (tmon > 12)
tmon = 12;
tempdays += MAX_DAYINMONTH(tyr, tmon);