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
9f1c6bf6
Commit
9f1c6bf6
authored
Dec 12, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Dec 12, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OLE: Fix SafeArrayCopy for NULL pvData.
It is allowed to copy a SAFEARRAY with a NULL pvData, as long as cbElements is non-zero. Add a test for this and fix the safe array code.
parent
6c3e1f9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
safearray.c
dlls/oleaut32/safearray.c
+9
-1
safearray.c
dlls/oleaut32/tests/safearray.c
+14
-1
No files found.
dlls/oleaut32/safearray.c
View file @
9f1c6bf6
...
...
@@ -355,7 +355,9 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell)
/* Copy data items from one array to another */
static
HRESULT
SAFEARRAY_CopyData
(
SAFEARRAY
*
psa
,
SAFEARRAY
*
dest
)
{
if
(
!
psa
->
pvData
||
!
dest
->
pvData
||
psa
->
fFeatures
&
FADF_DATADELETED
)
if
(
!
psa
->
pvData
)
return
S_OK
;
else
if
(
!
dest
->
pvData
||
psa
->
fFeatures
&
FADF_DATADELETED
)
return
E_INVALIDARG
;
else
{
...
...
@@ -1378,6 +1380,12 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
if
(
!
psa
)
return
S_OK
;
/* Handles copying of NULL arrays */
if
(
!
psa
->
cbElements
)
{
ERR
(
"not copying an array of 0 elements
\n
"
);
return
E_INVALIDARG
;
}
if
(
psa
->
fFeatures
&
(
FADF_RECORD
|
FADF_HAVEIID
|
FADF_HAVEVARTYPE
))
{
VARTYPE
vt
;
...
...
dlls/oleaut32/tests/safearray.c
View file @
9f1c6bf6
...
...
@@ -1418,7 +1418,7 @@ static void test_SafeArrayClear(void)
static
void
test_SafeArrayCopy
(
void
)
{
SAFEARRAYBOUND
sab
;
SAFEARRAY
*
sa
;
SAFEARRAY
*
sa
,
*
sa2
;
VARIANTARG
vSrc
,
vDst
;
HRESULT
hres
;
...
...
@@ -1450,6 +1450,19 @@ static void test_SafeArrayCopy(void)
SafeArrayDestroy
(
V_ARRAY
(
&
vSrc
));
SafeArrayDestroy
(
V_ARRAY
(
&
vDst
));
hres
=
SafeArrayAllocDescriptor
(
1
,
&
sa
);
ok
(
hres
==
S_OK
,
"SafeArrayAllocDescriptor failed with error 0x%08lx
\n
"
,
hres
);
hres
=
SafeArrayCopy
(
sa
,
&
sa2
);
ok
(
hres
==
E_INVALIDARG
,
"SafeArrayCopy with empty array should have failed with error E_INVALIDARG instead of 0x%08lx
\n
"
,
hres
);
sa
->
cbElements
=
16
;
hres
=
SafeArrayCopy
(
sa
,
&
sa2
);
ok
(
hres
==
S_OK
,
"SafeArrayCopy failed with error 0x%08lx
\n
"
,
hres
);
SafeArrayDestroy
(
sa
);
}
#define MKARRAY(low,num,typ) sab.lLbound = low; sab.cElements = num; \
...
...
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