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

Fixes array overflow in FMCS code #5205

Merged
merged 1 commit into from
Apr 17, 2022

Conversation

ricrogz
Copy link
Contributor

@ricrogz ricrogz commented Apr 16, 2022

I've been playing with address sanitization on Python tests (fortunately, asan is way faster than valgrind when working around Python).

Some Python test revealed an array overflow in line 204 of Code/GraphMol/FMCS/MaximumCommonSubgraph.cpp. I'm not familiar with the FMCS code, but this looks like a bug to me.

Sadly, I don't know how to write a test that would expose this.

@@ -157,8 +157,8 @@ void MaximumCommonSubgraph::init() {
labels.clear();
currentLabelValue = 1;
nq = QueryMolecule->getNumBonds();
QueryBondLabels.resize(nq);
for (size_t aj = 0; aj < nq; aj++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think using "aj" as a bond iterator was the recipe for disaster here.

nice catch.

Copy link
Member

@greglandrum greglandrum left a comment

Choose a reason for hiding this comment

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

LGTM

@greglandrum greglandrum changed the title Fixes one bug in FMCS code Fixes array overflow in FMCS code Apr 17, 2022
@greglandrum greglandrum added this to the 2022_03_2 milestone Apr 17, 2022
@greglandrum greglandrum merged commit 7ecfc20 into rdkit:master Apr 17, 2022
@ricrogz ricrogz deleted the potential_bug_in_FMCS branch April 17, 2022 03:24
greglandrum pushed a commit that referenced this pull request Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants