Fix SIGSEGV with unsupported atom types in SDF ligands#180
Open
caic99 wants to merge 4 commits into
Open
Conversation
…ron) Add atom type validation to parse_sdf_atom_string() matching the existing check in parse_pdbqt_atom_string(). Without this, unsupported elements like boron return AD_TYPE_SIZE (sentinel value 35) from string_to_ad_type(), leading to out-of-bounds grid access and a segfault. Now the parser throws a struct_parse_error so the ligand is skipped gracefully. Also adds the is_non_ad_metal_name() check for non-AD metal types, which was similarly missing from the SDF parser. Fixes dptech-corp#138 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Miniforge 26.x (released Feb 2026) ships Python 3.13 by default, but the openbabel conda-forge package only has builds up to Python 3.12. This caused the "install tools" step to fail for all PRs. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This reverts commit ab6103c.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parse_sdf_atom_string()inparse_pdbqt.cpp, matching the existing check inparse_pdbqt_atom_string()AD_TYPE_SIZEsentinel, causing out-of-bounds grid accessis_non_ad_metal_name()check for non-AD metal types in SDF parserRoot Cause
parse_sdf_atom_string()did not validate atom types. When an SDF contains boron or other unsupported elements,string_to_ad_type("B")returnsAD_TYPE_SIZE(35). The atom was added to the model without validation, and later grid evaluation accessedm_grids[35]out of bounds, causing a segfault.The PDBQT parser already had this validation via
acceptable_type()+struct_parse_error, but the SDF parser was missing it entirely.Test plan
Fixes #138
🤖 Generated with Claude Code