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

Check for uninitialized py::object #41

Merged
merged 1 commit into from
Jul 3, 2019
Merged

Conversation

eirrgang
Copy link
Collaborator

@eirrgang eirrgang commented Jul 2, 2019

The build() function that instantiates the potential and publishes it to the MD subscriber did not check whether there was an actual subscriber object to publish to. A pybind11::object is initialized with a nullptr member rather than None or a reference-counted Python object, so this sort of access causes a segmentation fault instead of a Python error. We could consider initializing py::object members to None, but a simple check suffices for now. In the longer run, we are reworking this protocol and one goal should be to avoid holding Python references at all.

I also checked the kassonlab/gmxapi sources and don't see any similarly unsafe uses of py::object, so I think this PR resolves kassonlab/gmxapi#226

@eirrgang eirrgang force-pushed the gmxapi-226 branch 3 times, most recently from af0b9cb to 6e48bb1 Compare July 3, 2019 12:05
@eirrgang eirrgang requested a review from jmhays July 3, 2019 12:34
@eirrgang eirrgang merged commit 66d21d4 into kassonlab:devel Jul 3, 2019
@eirrgang eirrgang deleted the gmxapi-226 branch July 3, 2019 13:14
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