[cig-commits] commit: Fix a bug where we were writing past the end of an array.
Mercurial
hg at geodynamics.org
Wed Nov 9 15:20:58 PST 2011
changeset: 635:8cd67cab7ba4
user: Walter Landry <wlandry at caltech.edu>
date: Wed Nov 09 15:19:33 2011 -0800
files: Mesh/src/Mesh_HexType.cxx
description:
Fix a bug where we were writing past the end of an array.
diff -r 56dbfba1e984 -r 8cd67cab7ba4 Mesh/src/Mesh_HexType.cxx
--- a/Mesh/src/Mesh_HexType.cxx Wed Nov 09 00:54:58 2011 -0800
+++ b/Mesh/src/Mesh_HexType.cxx Wed Nov 09 15:19:33 2011 -0800
@@ -52,6 +52,7 @@ const Type Mesh_HexType_Type = "Mesh_Hex
const Type Mesh_HexType_Type = "Mesh_HexType";
const int max_vertices(27);
+const int cube_vertices(8);
/*----------------------------------------------------------------------------------------------------------------------------------
** Constructors
@@ -90,7 +91,7 @@ void _Mesh_HexType_Init( Mesh_HexType* s
void _Mesh_HexType_Init( Mesh_HexType* self ) {
assert( self && Stg_CheckType( self, Mesh_HexType ) );
- self->vertMap = AllocArray( unsigned, max_vertices );
+ self->vertMap = AllocArray( unsigned, cube_vertices );
self->inc = AllocArray( unsigned, max_vertices );
Mesh_HexType_SetVertexMap( self );
@@ -298,7 +299,7 @@ void Mesh_HexType_SetVertexMap( void* he
assert( self && Stg_CheckType( self, Mesh_HexType ) );
- for( v_i = 0; v_i < max_vertices; v_i++ )
+ for( v_i = 0; v_i < cube_vertices; v_i++ )
self->vertMap[v_i] = v_i;
}
@@ -310,7 +311,7 @@ void Mesh_HexType_SetQ2Inds( void* hexTy
unsigned index_map[]={0,1,3,4,9,10,12,13};
/* Set vertmap so that MinimumSeparation will work */
- for(int i=0; i<max_vertices; i++)
+ for(int i=0; i<cube_vertices; i++)
self->vertMap[i] = index_map[i];
}
More information about the CIG-COMMITS
mailing list