Commit 94b9b614 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

oleaut32: Convert to VT_DECIMAL fails with overflow (with test).

parent c76d5561
......@@ -1391,6 +1391,11 @@ static const char *szFailOk = "Call failed, hres = %08x\n";
#define EXPECT_CY(val) EXPECT_OK { EXPECT_TYPE(VT_CY); \
ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = 0x%x%08x, got 0x%x%08x\n", \
(DWORD)((LONG64)val >> 23), (DWORD)(LONG64)val, (DWORD)(V_CY(&vOut).int64 >>32), (DWORD)V_CY(&vOut).int64); }
#define EXPECT_DECIMAL(valHi, valMid, valLo) EXPECT_OK { EXPECT_TYPE(VT_DECIMAL); \
ok((V_DECIMAL(&vOut).Hi32 == valHi) && (V_DECIMAL(&vOut).Mid32 == valMid) && \
(V_DECIMAL(&vOut).Lo32 == valLo), \
"Expected decimal = %x/0x%x%08x, got %x/0x%x%08x\n", valHi, valMid, valLo, \
V_DECIMAL(&vOut).Hi32, V_DECIMAL(&vOut).Mid32, V_DECIMAL(&vOut).Lo32); }
static void test_VarNumFromParseNum(void)
{
......@@ -1454,6 +1459,8 @@ static void test_VarNumFromParseNum(void)
/* 0x7f */
SETRGB(0, 7); SETRGB(1, 0xf);
CONVERT(2,0,0,2,4,0, INTEGER_VTBITS); EXPECT_I1(0x7f);
SETRGB(0, 7); SETRGB(1, 0xf);
CONVERT(2,0,0,2,4,0, VTBIT_DECIMAL); EXPECT_DECIMAL(0,0,0x7f);
/* 0x7fff */
SETRGB(0, 7); SETRGB(1, 0xf); SETRGB(2, 0xf); SETRGB(3, 0xf);
CONVERT(4,0,0,4,4,0, INTEGER_VTBITS); EXPECT_I2(0x7fff);
......
......@@ -2019,7 +2019,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
V_UI8(pVarDst) = ul64;
return S_OK;
}
else if ((dwVtBits & REAL_VTBITS) == VTBIT_DECIMAL)
else if ((dwVtBits & VTBIT_DECIMAL) == VTBIT_DECIMAL)
{
V_VT(pVarDst) = VT_DECIMAL;
DEC_SIGNSCALE(&V_DECIMAL(pVarDst)) = SIGNSCALE(DECIMAL_POS,0);
......
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