kernelbase: Check for invalid value in FileTimeToSystemTime.
Signed-off-by: Daniel Lehman <dlehman@esri.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a4a7ab8e3b
commit
a5d14fa980
|
@ -400,11 +400,9 @@ static void test_FileTimeToSystemTime(void)
|
|||
ft.dwLowDateTime = -1;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = FileTimeToSystemTime(&ft, &st);
|
||||
todo_wine {
|
||||
ok(!ret, "expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
static void test_FileTimeToLocalFileTime(void)
|
||||
|
|
|
@ -3874,8 +3874,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH FileTimeToLocalFileTime( const FILETIME *utc, FILE
|
|||
BOOL WINAPI DECLSPEC_HOTPATCH FileTimeToSystemTime( const FILETIME *ft, SYSTEMTIME *systime )
|
||||
{
|
||||
TIME_FIELDS tf;
|
||||
const LARGE_INTEGER *li = (const LARGE_INTEGER *)ft;
|
||||
|
||||
RtlTimeToTimeFields( (const LARGE_INTEGER *)ft, &tf );
|
||||
if (li->QuadPart < 0)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
RtlTimeToTimeFields( li, &tf );
|
||||
systime->wYear = tf.Year;
|
||||
systime->wMonth = tf.Month;
|
||||
systime->wDay = tf.Day;
|
||||
|
|
Loading…
Reference in New Issue