Commit a5d14fa9 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

kernelbase: Check for invalid value in FileTimeToSystemTime.

parent a4a7ab8e
......@@ -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;
......
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