Fix bug with NASTRAN reader causing crash on Windows.
@@ -1105,7 +1105,15 @@ avtNASTRANFileFormat::ReadLine(ifstream& ifile, char *line)
//
// Programmer: Edward Rusu
// Creation: Mon Aug 13 14:31:24 PST 2018
+//
+// Modifications:
+// Kathleen Biagas, Tue Sep 25 16:00:00 MST 2018
+// Ensure verts up to index 'count' have been initialized. Prevents crash
+// later on when it is expected that 'count' values are either valid or
+// are set to -1.
+//
// ****************************************************************************
+
void
avtNASTRANFileFormat::ParseLine(vtkIdType *verts, char *line, int start,
int count)
@@ -1113,7 +1121,8 @@ avtNASTRANFileFormat::ParseLine(vtkIdType *verts, char *line, int start,
char *valstart = line + INDEX_FIELD_WIDTH * start;
char *valend = valstart + INDEX_FIELD_WIDTH;
char val_t;
- for (int i = 0; (i < count) && (*valstart != '\0'); i++) {
+ int i;
+ for (i = 0; (i < count) && (*valstart != '\0'); i++) {
if(*valstart == '+' || *valstart == '*')
{ // At blank continuation element
valstart += INDEX_FIELD_WIDTH;
@@ -1129,6 +1138,8 @@ avtNASTRANFileFormat::ParseLine(vtkIdType *verts, char *line, int start,
valstart += INDEX_FIELD_WIDTH;
valend += INDEX_FIELD_WIDTH;
}
+ for (int j = i; j < count; ++j)
+ verts[j] = -1;
}
// ****************************************************************************
@@ -1152,7 +1163,7 @@ avtNASTRANFileFormat::CheckBuildable(const vtkIdType *verts, int numExpected)
for (int i = 0; i < numExpected; i++) {
if (verts[i] == -1)
{
- buildable == 0;
+ buildable = 0;
break;
}
}
