Fix OOM / crash with hypervalent, high permutation molecules

Fix #2107 - adds these as regression tests
Cap the next_permutation loop at 9! = 362,880 iterations
On overflow, mark timeout.expired = true

Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
This commit is contained in:
Geoff Hutchison committed 2026-05-20 15:17:28 -04:00
1 parent 05e0e429c9
commit 8778b36b79
7 files changed
+45 -9

No files matched your search

+3
View File
@@ -117,6 +117,9 @@ int gen3dtest(int argc, char* argv[])
"3", false) );
//OB_ASSERT( doGen3DTest("C1=CC(=N)C=CC1=C(C2=CC=C(C=C2)N)C3=CC=C(C=C3)N.Cl",
// "3", false) );
// Regression for issue #342: isotope-hydrogen fragment plus a bare
// metal atom previously crashed gen3D.
OB_ASSERT( doGen3DTest("[2HH].[Li]", "3", false) );
break;
case 3: