Daniel Lehman : oleaut32: Return FALSE from SystemTimeToVariantTime if day > 31 or year is negative.
Alexandre Julliard
julliard at winehq.org
Fri Nov 15 13:14:29 CST 2013
Module: wine
Branch: master
Commit: 8306518424a24a19c9c88d87f98fd3ac0024415a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8306518424a24a19c9c88d87f98fd3ac0024415a
Author: Daniel Lehman <dlehman at esri.com>
Date: Mon Jan 30 11:12:54 2012 -0800
oleaut32: Return FALSE from SystemTimeToVariantTime if day > 31 or year is negative.
---
dlls/oleaut32/tests/vartest.c | 4 ++++
dlls/oleaut32/variant.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index a91eb7e..bc8c4ba 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -1727,6 +1727,10 @@ static void test_SystemTimeToVariantTime(void)
ST2DT(2,1,1980,0,0,0,0,TRUE,29222.0);
ST2DT(0,1,1980,0,0,0,0,TRUE,29220.0); /* Rolls back to 31 Dec 1899 */
ST2DT(1,13,1980,0,0,0,0,FALSE,29587.0); /* Fails on invalid month */
+ ST2DT(32,1,1980,0,0,0,0,FALSE,0.0); /* Fails on invalid day */
+ ST2DT(1,1,-1,0,0,0,0,FALSE,0.0); /* Fails on invalid year */
+ ST2DT(1,1,10000,0,0,0,0,FALSE,0.0); /* Fails on invalid year */
+ ST2DT(1,1,9999,0,0,0,0,TRUE,2958101.0); /* 9999 is last valid year */
ST2DT(31,12,90,0,0,0,0,TRUE,33238.0); /* 30 <= year < 100 is 1900+year */
ST2DT(1,1,30,0,0,0,0,TRUE,10959.0); /* 30 <= year < 100 is 1900+year */
ST2DT(1,1,29,0,0,0,0,TRUE,47119.0); /* 0 <= year < 30 is 2000+year */
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index c343578..d4c6f6c 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -1312,6 +1312,10 @@ INT WINAPI SystemTimeToVariantTime(LPSYSTEMTIME lpSt, double *pDateOut)
if (lpSt->wMonth > 12)
return FALSE;
+ if (lpSt->wDay > 31)
+ return FALSE;
+ if ((short)lpSt->wYear < 0)
+ return FALSE;
ud.st = *lpSt;
return VarDateFromUdate(&ud, 0, pDateOut) == S_OK;
More information about the wine-cvs
mailing list