Fix associativity bug in get_zcorn_sign

The bug can also cause c2 to be larger than the length of
actnum, leading to segmentation faults.
This commit is contained in:
Ivar Ursin Nikolaisen
2012-08-21 14:15:49 +02:00
parent d2e6125570
commit aaae8e170b

View File

@@ -588,7 +588,7 @@ get_zcorn_sign(int nx, int ny, int nz, const int *actnum,
z2 = sign*zcorn[i+2*nx*(j+2*ny*(k+1))];
c1 = i/2 + nx*(j/2 + ny*k/2);
c2 = i/2 + nx*(j/2 + ny*(k+1)/2);
c2 = i/2 + nx*(j/2 + ny*((k+1)/2));
if (((actnum == NULL) ||
(actnum[c1] && actnum[c2]))