Medit segfaults when it opens a mesh that contains only 1 hexahedra (1hexa.mesh.txt).
This segfault occurs during hexa adjacencies computations: first 6*mesh->nhex/4 positions of hcode array are initialized with inival value while the computed key can acces max( 2, mesh->nhex )+ 1 first positions. For mesh->nhex = 1, for example, the computed key may access the second box of the table while only positions 0 and 1 are initialized to inival and second box has value 0. Thus, when we travel the built linked list, the list may end on a 0 value instead the expectedinival one.
This PR adds a simple and robust fix is to add the check of null or negative values to the test of inival values to the stopping criterion of the link list travel. The same check already exists in the tetra hash table construction.
Another way to fix this should be to intialized the hsize positions of the hcode array, hsize being the maximal possible key.
Medit segfaults when it opens a mesh that contains only 1 hexahedra (1hexa.mesh.txt).
This segfault occurs during hexa adjacencies computations: first
6*mesh->nhex/4
positions ofhcode
array are initialized withinival
value while the computed key can accesmax( 2, mesh->nhex )+ 1
first positions. Formesh->nhex = 1
, for example, the computed key may access the second box of the table while only positions 0 and 1 are initialized toinival
and second box has value0
. Thus, when we travel the built linked list, the list may end on a 0 value instead the expectedinival
one.This PR adds a simple and robust fix is to add the check of null or negative values to the test of
inival
values to the stopping criterion of the link list travel. The same check already exists in the tetra hash table construction.Another way to fix this should be to intialized the
hsize
positions of thehcode
array,hsize
being the maximal possible key.