diff options
author | jthorn <jthorn@df1f8a13-aa1d-4dd4-9681-27ded5b42416> | 2002-12-20 15:10:22 +0000 |
---|---|---|
committer | jthorn <jthorn@df1f8a13-aa1d-4dd4-9681-27ded5b42416> | 2002-12-20 15:10:22 +0000 |
commit | bd533e3e3243827a5667ab2efbeefdb85ffda30f (patch) | |
tree | a5f69063e47f3402ee8c17e051d76d6c8c79ae1e /src/GeneralizedPolynomial-Uniform/template.c | |
parent | cb9aaede7365d60bc7e0543ce36873de7893607a (diff) |
add testing for the error case where the grid is smaller than the molecule
(before this would access memory off the end of the grid
==> core dump on some platforms, eg alphas)
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalInterp/trunk@122 df1f8a13-aa1d-4dd4-9681-27ded5b42416
Diffstat (limited to 'src/GeneralizedPolynomial-Uniform/template.c')
-rw-r--r-- | src/GeneralizedPolynomial-Uniform/template.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/GeneralizedPolynomial-Uniform/template.c b/src/GeneralizedPolynomial-Uniform/template.c index ac1d98e..0bb409b 100644 --- a/src/GeneralizedPolynomial-Uniform/template.c +++ b/src/GeneralizedPolynomial-Uniform/template.c @@ -945,37 +945,46 @@ int pt; /* is the interpolation point out-of-range? */ #if (N_DIMS >= 1) - if ((center_i == INT_MIN) || (center_i == INT_MAX)) + if (IS_MOLECULE_POSN_ERROR_CODE(center_i)) then { + if (center_i == MOLECULE_POSN_ERROR_GRID_TINY) + then return CCTK_ERROR_INTERP_GRID_TOO_TINY; if (error_flags != NULL) then { error_flags->error_pt = pt; error_flags->error_axis = X_AXIS; - error_flags->error_end = (center_i > 0) ? +1 : -1; + error_flags->error_end + = (center_i == MOLECULE_POSN_ERROR_X_GT_MAX) ? +1 : -1; } return CCTK_ERROR_INTERP_POINT_X_RANGE; /*** ERROR RETURN ***/ } #endif #if (N_DIMS >= 2) - if ((center_j == INT_MIN) || (center_j == INT_MAX)) + if (IS_MOLECULE_POSN_ERROR_CODE(center_j)) then { + if (center_j == MOLECULE_POSN_ERROR_GRID_TINY) + then return CCTK_ERROR_INTERP_GRID_TOO_TINY; if (error_flags != NULL) then { error_flags->error_pt = pt; error_flags->error_axis = Y_AXIS; - error_flags->error_end = (center_j > 0) ? +1 : -1; + error_flags->error_end + = (center_j == MOLECULE_POSN_ERROR_X_GT_MAX) ? +1 : -1; } return CCTK_ERROR_INTERP_POINT_X_RANGE; /*** ERROR RETURN ***/ } #endif #if (N_DIMS >= 3) - if ((center_k == INT_MIN) || (center_k == INT_MAX)) + if (IS_MOLECULE_POSN_ERROR_CODE(center_k)) then { + if (center_k == MOLECULE_POSN_ERROR_GRID_TINY) + then return CCTK_ERROR_INTERP_GRID_TOO_TINY; if (error_flags != NULL) then { error_flags->error_pt = pt; error_flags->error_axis = Z_AXIS; - error_flags->error_end = (center_k > 0) ? +1 : -1; + error_flags->error_end + = (center_k == MOLECULE_POSN_ERROR_X_GT_MAX) ? +1 : -1; } return CCTK_ERROR_INTERP_POINT_X_RANGE; /*** ERROR RETURN ***/ } |