msvcrt: Call invalid parameter handler for out-of-range integer.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jeff Smith 2019-11-25 08:10:05 -06:00 committed by Alexandre Julliard
parent eea87600d2
commit 8fe3d7c913
2 changed files with 5 additions and 6 deletions

View File

@ -996,9 +996,8 @@ static inline BOOL strftime_int(STRFTIME_CHAR *str, MSVCRT_size_t *pos, MSVCRT_s
#endif
MSVCRT_size_t len;
if(src<l || src>h) {
if(!MSVCRT_CHECK_PMT(src>=l && src<=h)) {
*str = 0;
*MSVCRT__errno() = MSVCRT_EINVAL;
return FALSE;
}

View File

@ -937,10 +937,10 @@ static void test_strftime(void)
{"%C", "19", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%C", "99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
{"%C", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }},
{"%d", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, FALSE, TRUE},
{"%d", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }},
{"%d", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%d", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }},
{"%d", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE},
{"%d", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }},
{"%D", "", { 0, 0, 0, 1, 0, -1901, 4, 0, 0 }},
{"%D", "01/01/00", { 0, 0, 0, 1, 0, -1900, 4, 0, 0 }},
{"%D", "01/01/99", { 0, 0, 0, 1, 0, -1, 4, 0, 0 }},
@ -948,10 +948,10 @@ static void test_strftime(void)
{"%D", "01/01/99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
{"%D", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }},
{"%#D", "1/1/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%e", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, FALSE, TRUE},
{"%e", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }},
{"%e", " 1", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%e", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }},
{"%e", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE},
{"%e", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }},
{"%#e", "1", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%F", "1970-01-01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%#F", "1970-1-1", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},