From 518a13cb41a064ae0bec34d7ae6b347db991369c Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 25 Sep 2024 11:19:45 -0400 Subject: [PATCH] Check that list is nonempty before calling factory function Otherwise we get a segfault --- M2/Macaulay2/e/interface/factory.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/M2/Macaulay2/e/interface/factory.cpp b/M2/Macaulay2/e/interface/factory.cpp index 957b2e59c03..7a827a7ee0a 100644 --- a/M2/Macaulay2/e/interface/factory.cpp +++ b/M2/Macaulay2/e/interface/factory.cpp @@ -785,6 +785,11 @@ M2_arrayintOrNull rawIdealReorder(const Matrix *M) } } + if (I.length() == 0) { + ERROR("expected at least one generator"); + return nullptr; + } + List t = neworderint(I); int n = t.length();