mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
oleaut32: Fix the overflow check in VarNumFromParseNum.
Spotted by Adam Martinson.
This commit is contained in:
parent
5d7aac8c38
commit
4e94fd5567
@ -2592,7 +2592,9 @@ static void test_VarUI8FromStr(void)
|
||||
CONVERT_STR(VarUI8FromStr,"0",0); EXPECTI8(0);
|
||||
CONVERT_STR(VarUI8FromStr,"-1",0); EXPECT_OVERFLOW;
|
||||
CONVERT_STR(VarUI8FromStr,"2147483647",0); EXPECTI8(2147483647);
|
||||
CONVERT_STR(VarUI8FromStr,"18446744073709551615",0); todo_wine EXPECTI864(0xFFFFFFFF,0xFFFFFFFF);
|
||||
CONVERT_STR(VarUI8FromStr,"18446744073709551614",0); EXPECTI864(0xFFFFFFFF,0xFFFFFFFE);
|
||||
CONVERT_STR(VarUI8FromStr,"18446744073709551615",0); EXPECTI864(0xFFFFFFFF,0xFFFFFFFF);
|
||||
CONVERT_STR(VarUI8FromStr,"18446744073709551616",0); EXPECT_OVERFLOW;
|
||||
|
||||
CONVERT_STR(VarUI8FromStr,"-1.5",LOCALE_NOUSEROVERRIDE); EXPECT_OVERFLOW;
|
||||
CONVERT_STR(VarUI8FromStr,"-0.6",LOCALE_NOUSEROVERRIDE); EXPECT_OVERFLOW;
|
||||
|
@ -2186,7 +2186,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
|
||||
/* Convert the integer part of the number into a UI8 */
|
||||
for (i = 0; i < wholeNumberDigits; i++)
|
||||
{
|
||||
if (ul64 > (UI8_MAX / 10 - rgbDig[i]))
|
||||
if (ul64 > UI8_MAX / 10 || (ul64 == UI8_MAX / 10 && rgbDig[i] > UI8_MAX % 10))
|
||||
{
|
||||
TRACE("Overflow multiplying digits\n");
|
||||
bOverflow = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user