Skip to content

Fix python segfault when using an invalid Aligner - #1344

Open
blawrence-ont wants to merge 2 commits into
lh3:masterfrom
blawrence-ont:python-crash
Open

blawrence-ont wants to merge 2 commits into
lh3:masterfrom
blawrence-ont:python-crash

Conversation

@blawrence-ont

Copy link
Copy Markdown
Contributor

Similar to #1195, we recently saw python segfault due to malformed paths.

Simple repro case in the REPL is:

>>> from mappy import Aligner
>>> aligner = Aligner("bad")
>>> aligner.
Segmentation fault (core dumped)

where the segfault occurred on line 3 when pressing tab after the . to display attributes of the object. The same crash occurs if trying to access the fields with missing NULL checks, ie aligner.n_seq.

Note that #1195 is probably a better fix if a behaviour change is allowed and would avoid the need for any NULL checks.

See commit descriptions for more details.

Trying to use autocomplete on an Aligner that wasn't valid, for example
to debug it, would crash the REPL due to these missing checks. To fix
that add some checks that were missing.

Technically returning None is the same as returning nothing, but it's
best to be consistent.
This was showing up as importable under mappy, ie the following worked:
>>> from mappy import sys

This branch has not been deployed

No deployments
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