Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security review of deepcopy out support #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mingweishih
Copy link
Owner

Signed-off-by: Ming-Wei Shih [email protected]

Signed-off-by: Ming-Wei Shih <[email protected]>
pargs_out->n[_i_1].array_of_int = NULL;
if (_rhs[_i_1].array_of_int)
{
int* _l_1_array_of_int =
Copy link
Owner Author

Choose a reason for hiding this comment

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

Own comment: use local variable to prevent the host from manipulating the memory used by the memcpy below. Note that the oe_host_malloc ensures that the return buffer resides on the host.

_rhs[_i_1].array_of_int,
((size_t)4 * sizeof(int)));
}
CountStruct* _l_1_array_of_struct = NULL;
Copy link
Owner Author

Choose a reason for hiding this comment

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

Same as above.

_l_1_array_of_struct[_i_2].ptr = NULL;
if (_rhs[_i_1].array_of_struct[_i_2].ptr)
{
uint64_t* _l_2_ptr = (uint64_t*)oe_host_malloc(
Copy link
Owner Author

Choose a reason for hiding this comment

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

Same as above.

{
int* _l_1_array_of_int =
(int*)oe_host_malloc(((size_t)4 * sizeof(int)));
pargs_out->n[_i_1].array_of_int = _l_1_array_of_int;
Copy link
Owner Author

Choose a reason for hiding this comment

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

pargs_out->n[_i_1].array_of_int is under control by the host, but we won't use it directly other than this assignment.

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.

1 participant