Revision: 76900
http://sourceforge.net/p/brlcad/code/76900
Author: brlcad
Date: 2020-08-23 13:35:34 +0000 (Sun, 23 Aug 2020)
Log Message:
-----------
trigger an anything greater than our capacity for safety, not just the full
value.
Modified Paths:
--------------
brlcad/trunk/src/libanalyze/density.cpp
Modified: brlcad/trunk/src/libanalyze/density.cpp
===================================================================
--- brlcad/trunk/src/libanalyze/density.cpp 2020-08-23 05:50:34 UTC (rev
76899)
+++ brlcad/trunk/src/libanalyze/density.cpp 2020-08-23 13:35:34 UTC (rev
76900)
@@ -29,9 +29,14 @@
#include "analyze.h"
+
+/* the largest material ID value that can be used in a density table */
#define MAX_MATERIAL_ID 32768
+
+/* arbitrary upper limit just to prevent out-of-control behavior */
#define MAX_MATERIAL_CNT 1000000
+
struct analyze_densities_impl {
std::map<long int,std::string> id2name;
std::map<long int,fastf_t> id2density;
@@ -80,14 +85,14 @@
if (id > MAX_MATERIAL_ID) {
if (msgs) {
- bu_vls_printf(msgs, "Error: material id %ld is large than
MAX_MATERIAL_ID (%d)\n", id, MAX_MATERIAL_ID);
+ bu_vls_printf(msgs, "ERROR: material ID %ld is larger than
MAX_MATERIAL_ID (%d)\n", id, MAX_MATERIAL_ID);
}
return -1;
}
- if (a->i->id2density.size() == MAX_MATERIAL_CNT) {
+ if (a->i->id2density.size() >= MAX_MATERIAL_CNT) {
if (msgs) {
- bu_vls_printf(msgs, "Error: analyze densities database is full -
maximum density count of %d has been reached\n", MAX_MATERIAL_CNT);
+ bu_vls_printf(msgs, "ERROR: Maximum materials (%d) exceeded in
density table.\n", MAX_MATERIAL_CNT);
}
return -1;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits