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

rdScaffoldNetwork causes segmenation fault upon None molecule #3177

Closed
AnsgarSchuffenhauer opened this issue May 19, 2020 · 2 comments
Closed
Labels
Milestone

Comments

@AnsgarSchuffenhauer
Copy link

Configuration:

  • RDKit Version: 2020.03.1
  • Operating system: linux (CentOS7)
  • Python version (if relevant): 3.8
  • Are you using conda? yes
  • If you are using conda, which channel did you install the rdkit from?
  • If you are not using conda: how did you install the RDKit?

Description:
When feeding a None molecule to rdScaffoldNetwork.CreateScaffoldNetwork() this systemtcially ends up in asegmenation fault. Other regular molecules are processed OK.

>>> from rdkit.Chem.Scaffolds import rdScaffoldNetwork
params = rdScaffoldNetwork.ScaffoldNetworkParams()
params.flattenIsotopes=True
params.includeGenericBondScaffolds=False
params.includeGenericScaffolds=False
params.includeScaffoldsWithAttachments = False
params.includeScaffoldsWithoutAttachments = True
params.pruneBeforeFragmenting = True
sn = rdScaffoldNetwork.CreateScaffoldNetwork([None],params)

==> Segmentation fault

I fully appreciate that I should have checked for proper parsing of the molecule record first, with the mol is not None, and that of course a None molecule cannot generate a valid scaffold network. However, still I would have expected to get an exception in this situation (which I could have contained within a try -except clause), and not a segmentation fault right away.

The issue is not burning, as now that I am aware of the problem, I can prevent the feeding of None molecules.

@greglandrum
Copy link
Member

Simple reproducible here:

In [2]: from rdkit.Chem.Scaffolds import rdScaffoldNetwork
In [3]: rdScaffoldNetwork.CreateScaffoldNetwork([None],rdScaffoldNetwork.ScaffoldNetworkParams())

crash!

@greglandrum
Copy link
Member

Thanks for reporting this Ansgar. The code should not, under any circumstances, seg fault and crash like this.

@greglandrum greglandrum added this to the 2020_03_3 milestone May 19, 2020
greglandrum added a commit to greglandrum/rdkit that referenced this issue May 26, 2020
greglandrum added a commit that referenced this issue Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants