Skip to content

Conversation

@oldnewthing
Copy link
Member

@oldnewthing oldnewthing commented Feb 25, 2020

For array parameters, ensure that nullptr is not passed as the array base, even for empty arrays. If the array is empty, the array base is not used, but RPC still requires it to be a non-null pointer.

We use a properly aligned non-null pointer as our fake array base, in case somebody cares about alignment.

Note that this fix does not address [out] parameters. The workaround for [out] parameters is more expensive (need to CoTaskMemAlloc(0)) and it is necessary only for out-of-process calls, so I don't want to incur the overhead for everybody. People returning empty com_arrays will have to remain vigilant.

Also fix BO in test Class when asked to fill an empty array.

@kennykerr
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

For array parameters, ensure that nullptr is not passed
as the array base, even for empty arrays. If the array
is empty, the array base is not used, but RPC still requires
it to be a non-null pointer.

We use a properly aligned non-null pointer as our fake
array base, in case somebody cares about alignment.

Note that this fix does not address [out] parameters.
The workaround for [out] parameters is more expensive
(need to CoTaskMemAlloc(0)) and it is necessary only
for out-of-process calls, so I don't want to incur the
overhead for everybody. People returning empty com_arrays
will have to remain vigilant.

Also fix BO in test Class when asked to fill an empty array.
@kennykerr
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kennykerr kennykerr merged commit e347c60 into microsoft:master Feb 28, 2020
@oldnewthing oldnewthing deleted the empty-array branch February 28, 2020 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants