Skip to content

Infinite loop in SDGenerator #540

Description

@dstoeckel

When trying to reproduce bug #536 I used BALLViews "Build from SMILES" functionality to generate the suggested example molecule:

COc1=c2c(=cc=c1)OCCCCCCCCOc1=c(c3=c4c(=c2c2=cc=cc=c32)c=cc=c4)c(=cc=c1)O

However, processing of this SMILE never terminates. Processing seems to hang in BALL::RingAnalyser::sequenceRing:

while(!ring_atoms.empty())
{
    for (std::list<Atom*>::iterator ring_it  = ring_atoms.begin();
                                    ring_it != ring_atoms.end(); ++ring_it)
    {
        if (last_atom->isBoundTo(**ring_it))
        {
            ring[++last_index] = *ring_it;
            last_atom = *ring_it;
            ring_atoms.erase(ring_it);
            break;
        }
    }
}

Termination if no ring atom could be erased:

while(!ring_atoms.empty())
{
    bool found = false;
    for (std::list<Atom*>::iterator ring_it  = ring_atoms.begin();
                                    ring_it != ring_atoms.end(); ++ring_it)
    {
        if (last_atom->isBoundTo(**ring_it))
        {
            ring[++last_index] = *ring_it;
            last_atom = *ring_it;
            ring_atoms.erase(ring_it);
            found = true;
            break;
        }
    }
    if(!found) break;
}

lead to a subsequent segmentation fault in BALL::RingAnalyser::peelNextRing_.

Edit: fix bogus termination condition

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions