Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1809f7c7
Commit
1809f7c7
authored
Mar 24, 2014
by
Shuai Meng
Committed by
Alexandre Julliard
Mar 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Fixed bounds of VarIntFromFloat.
parent
c820bddd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
6 deletions
+48
-6
vartype.c
dlls/oleaut32/tests/vartype.c
+42
-0
vartype.c
dlls/oleaut32/vartype.c
+6
-6
No files found.
dlls/oleaut32/tests/vartype.c
View file @
1809f7c7
...
...
@@ -739,11 +739,15 @@ static void test_VarI1FromR4(void)
CHECKPTR
(
VarI1FromR4
);
CONVERT
(
VarI1FromR4
,
-
129
.
0
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR4
,
-
128
.
51
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR4
,
-
128
.
5
f
);
EXPECT
(
-
128
);
CONVERT
(
VarI1FromR4
,
-
128
.
0
f
);
EXPECT
(
-
128
);
CONVERT
(
VarI1FromR4
,
-
1
.
0
f
);
EXPECT
(
-
1
);
CONVERT
(
VarI1FromR4
,
0
.
0
f
);
EXPECT
(
0
);
CONVERT
(
VarI1FromR4
,
1
.
0
f
);
EXPECT
(
1
);
CONVERT
(
VarI1FromR4
,
127
.
0
f
);
EXPECT
(
127
);
CONVERT
(
VarI1FromR4
,
127
.
49
f
);
EXPECT
(
127
);
CONVERT
(
VarI1FromR4
,
127
.
5
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR4
,
128
.
0
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR4
,
-
1
.
5
f
);
EXPECT
(
-
2
);
...
...
@@ -762,11 +766,15 @@ static void test_VarI1FromR8(void)
CHECKPTR
(
VarI1FromR8
);
CONVERT
(
VarI1FromR8
,
-
129
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR8
,
-
128
.
51
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR8
,
-
128
.
5
);
EXPECT
(
-
128
);
CONVERT
(
VarI1FromR8
,
-
128
.
0
);
EXPECT
(
-
128
);
CONVERT
(
VarI1FromR8
,
-
1
.
0
);
EXPECT
(
-
1
);
CONVERT
(
VarI1FromR8
,
0
.
0
);
EXPECT
(
0
);
CONVERT
(
VarI1FromR8
,
1
.
0
);
EXPECT
(
1
);
CONVERT
(
VarI1FromR8
,
127
.
0
);
EXPECT
(
127
);
CONVERT
(
VarI1FromR8
,
127
.
49
);
EXPECT
(
127
);
CONVERT
(
VarI1FromR8
,
127
.
5
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR8
,
128
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI1FromR8
,
-
1
.
5
);
EXPECT
(
-
2
);
...
...
@@ -983,9 +991,13 @@ static void test_VarUI1FromR4(void)
CHECKPTR
(
VarUI1FromR4
);
CONVERT
(
VarUI1FromR4
,
-
1
.
0
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI1FromR4
,
-
0
.
51
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI1FromR4
,
-
0
.
5
f
);
EXPECT
(
0
);
CONVERT
(
VarUI1FromR4
,
0
.
0
f
);
EXPECT
(
0
);
CONVERT
(
VarUI1FromR4
,
1
.
0
f
);
EXPECT
(
1
);
CONVERT
(
VarUI1FromR4
,
255
.
0
f
);
EXPECT
(
255
);
CONVERT
(
VarUI1FromR4
,
255
.
49
f
);
EXPECT
(
255
);
CONVERT
(
VarUI1FromR4
,
255
.
5
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI1FromR4
,
256
.
0
f
);
EXPECT_OVERFLOW
;
/* Rounding */
...
...
@@ -1005,9 +1017,13 @@ static void test_VarUI1FromR8(void)
CHECKPTR
(
VarUI1FromR8
);
CONVERT
(
VarUI1FromR8
,
-
1
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI1FromR8
,
-
0
.
51
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI1FromR8
,
-
0
.
5
);
EXPECT
(
0
);
CONVERT
(
VarUI1FromR8
,
0
.
0
);
EXPECT
(
0
);
CONVERT
(
VarUI1FromR8
,
1
.
0
);
EXPECT
(
1
);
CONVERT
(
VarUI1FromR8
,
255
.
0
);
EXPECT
(
255
);
CONVERT
(
VarUI1FromR8
,
255
.
49
);
EXPECT
(
255
);
CONVERT
(
VarUI1FromR8
,
255
.
5
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI1FromR8
,
256
.
0
);
EXPECT_OVERFLOW
;
/* Rounding */
...
...
@@ -1281,11 +1297,15 @@ static void test_VarI2FromR4(void)
CHECKPTR
(
VarI2FromR4
);
CONVERT
(
VarI2FromR4
,
-
32769
.
0
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI2FromR4
,
-
32768
.
51
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI2FromR4
,
-
32768
.
5
f
);
EXPECT
(
-
32768
);
CONVERT
(
VarI2FromR4
,
-
32768
.
0
f
);
EXPECT
(
-
32768
);
CONVERT
(
VarI2FromR4
,
-
1
.
0
f
);
EXPECT
(
-
1
);
CONVERT
(
VarI2FromR4
,
0
.
0
f
);
EXPECT
(
0
);
CONVERT
(
VarI2FromR4
,
1
.
0
f
);
EXPECT
(
1
);
CONVERT
(
VarI2FromR4
,
32767
.
0
f
);
EXPECT
(
32767
);
CONVERT
(
VarI2FromR4
,
32767
.
49
f
);
EXPECT
(
32767
);
CONVERT
(
VarI2FromR4
,
32767
.
5
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI2FromR4
,
32768
.
0
f
);
EXPECT_OVERFLOW
;
/* Rounding */
...
...
@@ -1305,11 +1325,15 @@ static void test_VarI2FromR8(void)
CHECKPTR
(
VarI2FromR8
);
CONVERT
(
VarI2FromR8
,
-
32769
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI2FromR8
,
-
32768
.
51
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI2FromR8
,
-
32768
.
5
);
EXPECT
(
-
32768
);
CONVERT
(
VarI2FromR8
,
-
32768
.
0
);
EXPECT
(
-
32768
);
CONVERT
(
VarI2FromR8
,
-
1
.
0
);
EXPECT
(
-
1
);
CONVERT
(
VarI2FromR8
,
0
.
0
);
EXPECT
(
0
);
CONVERT
(
VarI2FromR8
,
1
.
0
);
EXPECT
(
1
);
CONVERT
(
VarI2FromR8
,
32767
.
0
);
EXPECT
(
32767
);
CONVERT
(
VarI2FromR8
,
32767
.
49
);
EXPECT
(
32767
);
CONVERT
(
VarI2FromR8
,
32767
.
5
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI2FromR8
,
32768
.
0
);
EXPECT_OVERFLOW
;
/* Rounding */
...
...
@@ -1529,9 +1553,13 @@ static void test_VarUI2FromR4(void)
CHECKPTR
(
VarUI2FromR4
);
CONVERT
(
VarUI2FromR4
,
-
1
.
0
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI2FromR4
,
-
0
.
51
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI2FromR4
,
-
0
.
5
f
);
EXPECT
(
0
);
CONVERT
(
VarUI2FromR4
,
0
.
0
f
);
EXPECT
(
0
);
CONVERT
(
VarUI2FromR4
,
1
.
0
f
);
EXPECT
(
1
);
CONVERT
(
VarUI2FromR4
,
65535
.
0
f
);
EXPECT
(
65535
);
CONVERT
(
VarUI2FromR4
,
65535
.
49
f
);
EXPECT
(
65535
);
CONVERT
(
VarUI2FromR4
,
65535
.
5
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI2FromR4
,
65536
.
0
f
);
EXPECT_OVERFLOW
;
/* Rounding */
...
...
@@ -1551,9 +1579,13 @@ static void test_VarUI2FromR8(void)
CHECKPTR
(
VarUI2FromR8
);
CONVERT
(
VarUI2FromR8
,
-
1
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI2FromR8
,
-
0
.
51
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI2FromR8
,
-
0
.
5
);
EXPECT
(
0
);
CONVERT
(
VarUI2FromR8
,
0
.
0
);
EXPECT
(
0
);
CONVERT
(
VarUI2FromR8
,
1
.
0
);
EXPECT
(
1
);
CONVERT
(
VarUI2FromR8
,
65535
.
0
);
EXPECT
(
65535
);
CONVERT
(
VarUI2FromR8
,
65535
.
49
);
EXPECT
(
65535
);
CONVERT
(
VarUI2FromR8
,
65535
.
5
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI2FromR8
,
65536
.
0
);
EXPECT_OVERFLOW
;
/* Rounding */
...
...
@@ -1792,11 +1824,15 @@ static void test_VarI4FromR8(void)
CHECKPTR
(
VarI4FromR8
);
CONVERT
(
VarI4FromR8
,
-
2147483649
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI4FromR8
,
-
2147483648
.
51
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI4FromR8
,
-
2147483648
.
5
);
EXPECT
(
-
2147483647
-
1
);
CONVERT
(
VarI4FromR8
,
-
2147483648
.
0
);
EXPECT
(
-
2147483647
-
1
);
CONVERT
(
VarI4FromR8
,
-
1
.
0
);
EXPECT
(
-
1
);
CONVERT
(
VarI4FromR8
,
0
.
0
);
EXPECT
(
0
);
CONVERT
(
VarI4FromR8
,
1
.
0
);
EXPECT
(
1
);
CONVERT
(
VarI4FromR8
,
2147483647
.
0
);
EXPECT
(
2147483647
);
CONVERT
(
VarI4FromR8
,
2147483647
.
49
);
EXPECT
(
2147483647
);
CONVERT
(
VarI4FromR8
,
2147483647
.
5
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI4FromR8
,
2147483648
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarI4FromR8
,
-
1
.
5
);
EXPECT
(
-
2
);
...
...
@@ -2017,6 +2053,8 @@ static void test_VarUI4FromR4(void)
CHECKPTR
(
VarUI4FromR4
);
/* We can't test max values as they are not exactly representable in a float */
CONVERT
(
VarUI4FromR4
,
-
1
.
0
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI4FromR4
,
-
0
.
51
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI4FromR4
,
-
0
.
5
f
);
EXPECT
(
0
);
CONVERT
(
VarUI4FromR4
,
0
.
0
f
);
EXPECT
(
0
);
CONVERT
(
VarUI4FromR4
,
1
.
0
f
);
EXPECT
(
1
);
...
...
@@ -2037,9 +2075,13 @@ static void test_VarUI4FromR8(void)
CHECKPTR
(
VarUI4FromR8
);
CONVERT
(
VarUI4FromR8
,
-
1
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI4FromR4
,
-
0
.
51
f
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI4FromR4
,
-
0
.
5
f
);
EXPECT
(
0
);
CONVERT
(
VarUI4FromR8
,
0
.
0
);
EXPECT
(
0
);
CONVERT
(
VarUI4FromR8
,
1
.
0
);
EXPECT
(
1
);
CONVERT
(
VarUI4FromR8
,
4294967295
.
0
);
EXPECT
(
4294967295ul
);
CONVERT
(
VarUI4FromR8
,
4294967295
.
49
);
EXPECT
(
4294967295ul
);
CONVERT
(
VarUI4FromR8
,
4294967295
.
5
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI4FromR8
,
4294967296
.
0
);
EXPECT_OVERFLOW
;
CONVERT
(
VarUI4FromR8
,
-
1
.
5
);
EXPECT_OVERFLOW
;
...
...
dlls/oleaut32/vartype.c
View file @
1809f7c7
...
...
@@ -362,7 +362,7 @@ HRESULT WINAPI VarI1FromR4(FLOAT fltIn, signed char* pcOut)
*/
HRESULT
WINAPI
VarI1FromR8
(
double
dblIn
,
signed
char
*
pcOut
)
{
if
(
dblIn
<
(
double
)
I1_MIN
||
dblIn
>
(
double
)
I1_MAX
)
if
(
dblIn
<
I1_MIN
-
0
.
5
||
dblIn
>=
I1_MAX
+
0
.
5
)
return
DISP_E_OVERFLOW
;
VARIANT_DutchRound
(
CHAR
,
dblIn
,
*
pcOut
);
return
S_OK
;
...
...
@@ -652,7 +652,7 @@ HRESULT WINAPI VarUI1FromR4(FLOAT fltIn, BYTE* pbOut)
*/
HRESULT
WINAPI
VarUI1FromR8
(
double
dblIn
,
BYTE
*
pbOut
)
{
if
(
dblIn
<
-
0
.
5
||
dblIn
>
(
double
)
UI1_MAX
)
if
(
dblIn
<
-
0
.
5
||
dblIn
>
=
UI1_MAX
+
0
.
5
)
return
DISP_E_OVERFLOW
;
VARIANT_DutchRound
(
BYTE
,
dblIn
,
*
pbOut
);
return
S_OK
;
...
...
@@ -958,7 +958,7 @@ HRESULT WINAPI VarI2FromR4(FLOAT fltIn, SHORT* psOut)
*/
HRESULT
WINAPI
VarI2FromR8
(
double
dblIn
,
SHORT
*
psOut
)
{
if
(
dblIn
<
(
double
)
I2_MIN
||
dblIn
>
(
double
)
I2_MAX
)
if
(
dblIn
<
I2_MIN
-
0
.
5
||
dblIn
>=
I2_MAX
+
0
.
5
)
return
DISP_E_OVERFLOW
;
VARIANT_DutchRound
(
SHORT
,
dblIn
,
*
psOut
);
return
S_OK
;
...
...
@@ -1270,7 +1270,7 @@ HRESULT WINAPI VarUI2FromR4(FLOAT fltIn, USHORT* pusOut)
*/
HRESULT
WINAPI
VarUI2FromR8
(
double
dblIn
,
USHORT
*
pusOut
)
{
if
(
dblIn
<
-
0
.
5
||
dblIn
>
(
double
)
UI2_MAX
)
if
(
dblIn
<
-
0
.
5
||
dblIn
>
=
UI2_MAX
+
0
.
5
)
return
DISP_E_OVERFLOW
;
VARIANT_DutchRound
(
USHORT
,
dblIn
,
*
pusOut
);
return
S_OK
;
...
...
@@ -1550,7 +1550,7 @@ HRESULT WINAPI VarI4FromR4(FLOAT fltIn, LONG *piOut)
*/
HRESULT
WINAPI
VarI4FromR8
(
double
dblIn
,
LONG
*
piOut
)
{
if
(
dblIn
<
(
double
)
I4_MIN
||
dblIn
>
(
double
)
I4_MAX
)
if
(
dblIn
<
I4_MIN
-
0
.
5
||
dblIn
>=
I4_MAX
+
0
.
5
)
return
DISP_E_OVERFLOW
;
VARIANT_DutchRound
(
LONG
,
dblIn
,
*
piOut
);
return
S_OK
;
...
...
@@ -1859,7 +1859,7 @@ HRESULT WINAPI VarUI4FromR4(FLOAT fltIn, ULONG *pulOut)
*/
HRESULT
WINAPI
VarUI4FromR8
(
double
dblIn
,
ULONG
*
pulOut
)
{
if
(
dblIn
<
-
0
.
5
||
dblIn
>
(
double
)
UI4_MAX
)
if
(
dblIn
<
-
0
.
5
||
dblIn
>
=
UI4_MAX
+
0
.
5
)
return
DISP_E_OVERFLOW
;
VARIANT_DutchRound
(
ULONG
,
dblIn
,
*
pulOut
);
return
S_OK
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment