Skip to content

Commit

Permalink
query crash
Browse files Browse the repository at this point in the history
  • Loading branch information
even1024 committed Dec 9, 2023
1 parent 89c7232 commit 19e4cb4
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/tests/integration/ref/formats/mol_features.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -13075,3 +13075,5 @@ M V30 END SGROUP
M V30 END CTAB
M END

*** 1431 Query explicit valency crash ***
[#6;+2;v;D0;$([*,#1]=,#,:[*,#1]);x0]1=[#6]-[#6]=[#6]-[#6]=[#6]-1.[#6]-[#6]-[#6@@](-[#6])-[#6]-[#6]
7 changes: 7 additions & 0 deletions api/tests/integration/tests/formats/mol_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,10 @@ def printGroupsInfo(m):
print(smiles)
indigo.setOption("molfile-saving-mode", "3000")
print(mol.molfile())

print("*** 1431 Query explicit valency crash ***")
qmol = indigo.loadQueryMoleculeFromFile(
joinPathPy("molecules/query_crash_1431.mol", __file__)
)

print(qmol.smarts())
38 changes: 38 additions & 0 deletions api/tests/integration/tests/formats/molecules/query_crash_1431.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

SMMXDraw07231311392D

0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 12 11 0 0 0
M V30 BEGIN ATOM
M V30 1 C 12.4156 -5.7104 0 0 CHG=2 VAL=1 INVRET=2 SUBST=-1 UNSAT=1 RBCNT=-2
M V30 2 C 13.7493 -6.4805 0 0
M V30 3 C 13.7493 -8.0205 0 0
M V30 4 C 12.4156 -8.7905 0 0
M V30 5 C 11.082 -8.0205 0 0
M V30 6 C 11.082 -6.4805 0 0
M V30 7 C 3.8438 -5.3438 0 0
M V30 8 C 4.703 -5.8398 0 0
M V30 9 C 5.5622 -5.3438 0 0 CFG=2
M V30 10 C 6.4214 -5.8398 0 0
M V30 11 C 7.2806 -5.3438 0 0
M V30 12 C 5.5622 -4.3516 0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 2 2 3
M V30 3 1 3 4
M V30 4 2 4 5
M V30 5 1 5 6
M V30 6 2 6 1
M V30 7 1 7 8
M V30 8 1 8 9
M V30 9 1 9 10
M V30 10 1 10 11
M V30 11 1 9 12 CFG=1
M V30 END BOND
M V30 BEGIN COLLECTION
M V30 MDLV30/STEREL1 ATOMS=(1 9)
M V30 END COLLECTION
M V30 END CTAB
M END
3 changes: 2 additions & 1 deletion core/indigo-core/molecule/src/query_molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,8 @@ QueryMolecule::Atom* QueryMolecule::releaseAtom(int idx)

void QueryMolecule::resetAtom(int idx, QueryMolecule::Atom* atom)
{
_atoms.reset(idx);
if (atom != _atoms[idx])
_atoms.reset(idx);
_atoms[idx] = atom;
updateEditRevision();
}
Expand Down

0 comments on commit 19e4cb4

Please sign in to comment.