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

Fix use-after-free issue with the global 'default_material' (issue 1483) #1583

Merged
merged 3 commits into from
Jun 3, 2021

Conversation

kkg4theweb
Copy link
Contributor

@kkg4theweb kkg4theweb commented Jun 1, 2021

Signed-off-by: Krishna Gadepalli kkg@google.com

Closes #1483.

Signed-off-by: Krishna Gadepalli <kkg@google.com>
@stevengj stevengj marked this pull request as ready for review June 3, 2021 19:04
src/material_data.hpp Outdated Show resolved Hide resolved

user_func = from.user_func;
// NOTE: the user_data field here opaque/void - so this is the best we can do.
user_data = from.user_data;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This may be problematic — we may need to increment a Python reference count.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a regression, however — filed as #1589

src/material_data.hpp Outdated Show resolved Hide resolved
src/material_data.hpp Outdated Show resolved Hide resolved
@stevengj stevengj merged commit cf14e30 into NanoComp:master Jun 3, 2021
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
…83) (NanoComp#1583)

* Fix use-after-free issue with the global 'default_material' (issue 1483)

Signed-off-by: Krishna Gadepalli <kkg@google.com>

* Make all copy_from methods take const ref.

* use size_t instead of 'int' when computing size for memcpy (update existing update_weights too)
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.

segmentation fault in _default_material argument of create_structure_and_set_materials
2 participants