Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
b440573d
Commit
b440573d
authored
Oct 12, 2021
by
Robert Wilhelm
Committed by
Alexandre Julliard
Oct 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Rescale result after overflow in VarDecAdd.
Signed-off-by:
Robert Wilhelm
<
robert.wilhelm@gmx.net
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6dcaff42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
vartype.c
dlls/oleaut32/tests/vartype.c
+2
-2
vartype.c
dlls/oleaut32/vartype.c
+37
-0
No files found.
dlls/oleaut32/tests/vartype.c
View file @
b440573d
...
@@ -3967,14 +3967,14 @@ static void test_VarDecAdd(void)
...
@@ -3967,14 +3967,14 @@ static void test_VarDecAdd(void)
S
(
U
(
out
)).
scale
,
S
(
U
(
out
)).
sign
,
out
.
Hi32
,
S1
(
U1
(
out
)).
Mid32
,
S1
(
U1
(
out
)).
Lo32
,
hres
);
S
(
U
(
out
)).
scale
,
S
(
U
(
out
)).
sign
,
out
.
Hi32
,
S1
(
U1
(
out
)).
Mid32
,
S1
(
U1
(
out
)).
Lo32
,
hres
);
SETDEC64
(
l
,
1
,
0
,
0xffffffff
,
0xffffffff
,
0xffffffff
);
SETDEC
(
r
,
1
,
0
,
0
,
1
);
MATH2
(
VarDecAdd
);
SETDEC64
(
l
,
1
,
0
,
0xffffffff
,
0xffffffff
,
0xffffffff
);
SETDEC
(
r
,
1
,
0
,
0
,
1
);
MATH2
(
VarDecAdd
);
todo_wine
EXPECTDEC64
(
0
,
0
,
0x19999999
,
0x99999999
,
0x9999999A
);
EXPECTDEC64
(
0
,
0
,
0x19999999
,
0x99999999
,
0x9999999A
);
SETDEC64
(
l
,
0
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
SETDEC64
(
r
,
0
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
MATH2
(
VarDecAdd
);
SETDEC64
(
l
,
0
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
SETDEC64
(
r
,
0
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
MATH2
(
VarDecAdd
);
ok
(
hres
==
DISP_E_OVERFLOW
,
"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x
\n
"
,
ok
(
hres
==
DISP_E_OVERFLOW
,
"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x
\n
"
,
S
(
U
(
out
)).
scale
,
S
(
U
(
out
)).
sign
,
out
.
Hi32
,
S1
(
U1
(
out
)).
Mid32
,
S1
(
U1
(
out
)).
Lo32
,
hres
);
S
(
U
(
out
)).
scale
,
S
(
U
(
out
)).
sign
,
out
.
Hi32
,
S1
(
U1
(
out
)).
Mid32
,
S1
(
U1
(
out
)).
Lo32
,
hres
);
SETDEC64
(
l
,
1
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
SETDEC64
(
r
,
1
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
MATH2
(
VarDecAdd
);
SETDEC64
(
l
,
1
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
SETDEC64
(
r
,
1
,
0
,
0xe22ea493
,
0xb30310a7
,
0x70000000
);
MATH2
(
VarDecAdd
);
todo_wine
EXPECTDEC64
(
0
,
0
,
0x2d3c8750
,
0xbd670354
,
0xb0000000
);
EXPECTDEC64
(
0
,
0
,
0x2d3c8750
,
0xbd670354
,
0xb0000000
);
SETDEC
(
l
,
3
,
128
,
0
,
123456
);
SETDEC64
(
r
,
0
,
0
,
0xFFFFFFFF
,
0xFFFFFFFF
,
0xFFFFFFFF
);
SETDEC
(
l
,
3
,
128
,
0
,
123456
);
SETDEC64
(
r
,
0
,
0
,
0xFFFFFFFF
,
0xFFFFFFFF
,
0xFFFFFFFF
);
MATH2
(
VarDecAdd
);
EXPECTDEC64
(
0
,
0
,
-
1
,
0xFFFFFFFF
,
0xFFFFFF84
);
MATH2
(
VarDecAdd
);
EXPECTDEC64
(
0
,
0
,
-
1
,
0xFFFFFFFF
,
0xFFFFFF84
);
...
...
dlls/oleaut32/vartype.c
View file @
b440573d
...
@@ -4643,6 +4643,43 @@ VarDecAdd_AsPositive:
...
@@ -4643,6 +4643,43 @@ VarDecAdd_AsPositive:
DEC_LO32
(
pDecOut
)
=
VARIANT_Add
(
DEC_LO32
(
pDecLeft
),
DEC_LO32
(
pDecRight
),
&
overflow
);
DEC_LO32
(
pDecOut
)
=
VARIANT_Add
(
DEC_LO32
(
pDecLeft
),
DEC_LO32
(
pDecRight
),
&
overflow
);
DEC_MID32
(
pDecOut
)
=
VARIANT_Add
(
DEC_MID32
(
pDecLeft
),
DEC_MID32
(
pDecRight
),
&
overflow
);
DEC_MID32
(
pDecOut
)
=
VARIANT_Add
(
DEC_MID32
(
pDecLeft
),
DEC_MID32
(
pDecRight
),
&
overflow
);
DEC_HI32
(
pDecOut
)
=
VARIANT_Add
(
DEC_HI32
(
pDecLeft
),
DEC_HI32
(
pDecRight
),
&
overflow
);
DEC_HI32
(
pDecOut
)
=
VARIANT_Add
(
DEC_HI32
(
pDecLeft
),
DEC_HI32
(
pDecRight
),
&
overflow
);
if
(
overflow
)
{
int
i
;
DWORD
n
[
4
];
unsigned
char
remainder
;
if
(
!
DEC_SCALE
(
pDecLeft
))
return
DISP_E_OVERFLOW
;
DEC_SCALE
(
pDecOut
)
=
DEC_SCALE
(
pDecLeft
)
-
1
;
DEC_SIGN
(
pDecOut
)
=
sign
;
n
[
0
]
=
DEC_LO32
(
pDecOut
);
n
[
1
]
=
DEC_MID32
(
pDecOut
);
n
[
2
]
=
DEC_HI32
(
pDecOut
);
n
[
3
]
=
overflow
;
remainder
=
VARIANT_int_divbychar
(
n
,
4
,
10
);
/* round up the result */
if
(
remainder
>=
5
)
{
for
(
remainder
=
1
,
i
=
0
;
i
<
ARRAY_SIZE
(
n
)
&&
remainder
;
i
++
)
{
ULONGLONG
digit
=
n
[
i
]
+
1
;
remainder
=
(
digit
>
0xFFFFFFFF
)
?
1
:
0
;
n
[
i
]
=
digit
&
0xFFFFFFFF
;
}
}
DEC_LO32
(
pDecOut
)
=
n
[
0
]
;
DEC_MID32
(
pDecOut
)
=
n
[
1
];
DEC_HI32
(
pDecOut
)
=
n
[
2
];
return
S_OK
;
}
}
}
if
(
overflow
)
if
(
overflow
)
...
...
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