From 7cd8d829644700410ced4971d97d32e520453710 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 24 Oct 2022 21:45:14 -0400 Subject: [PATCH] Fix for an error causing a segfault. This does not fix the underlying issue (which needs to be investigated), but it does prevent netgen from crashing when it encounters it (netgen will generate an erro message instead). --- VERSION | 2 +- base/netcmp.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7e4aaed..476edb5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.234 +1.5.235 diff --git a/base/netcmp.c b/base/netcmp.c index fa2ae92..76eecb9 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -5005,6 +5005,11 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series, // find ith record in ob p = 0; for (ob2 = ob; p != i; ob2 = ob2->next, p++); + /* Sanity check */ + if (ob2->type != PROPERTY) { + Fprintf(stderr, "Incorrect property run count!\n"); + continue; + } // Count entries, add one, reallocate for (p = 0;; p++) { vl = &ob2->instance.props[p];