#863 infinite loop in stereo perception when outputting sdf with added hydrogens

2.3.x
accepted
None
1
2013-03-22
2013-02-18
David Koes
No

When converting a molecule to sdf, you can end up in an infinite loop around line 2804 of stereo/perception.cpp. This loop assumes that a certain atom is in an array, and in this case it isn't. This only happens if hydrogens were added to the input. This only affects 2.3.2 (2.3.1 doesn't have this loop).

You can reproduce the bug with the attached file and
babel -h in.sdf out.sdf

My fix for the bug was to add these lines after 2799 in perception.cpp:

        if(implicit && std::find(test_cfg.refs.begin(), test_cfg.refs.end(), chosen->GetNbrAtom(center)->GetId()) == test_cfg.refs.end())
            implicit = false;

but this is just a bandaid since I don't really know what's going on in this code.

1 Attachments

Discussion

  • Noel O'Boyle

    Noel O'Boyle - 2013-02-18

    I've reproduced this...but it works fine currently on trunk. I'll keep the bug open to doublecheck when/if there is a 2.3.3, otherwise it's not worth me tracking down the origin.

     
  • Noel O'Boyle

    Noel O'Boyle - 2013-02-18
    • status: open --> accepted
    • assigned_to: Noel O'Boyle
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks