summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-02-08 16:44:54 +0100
committerAnton Khirnov <anton@khirnov.net>2019-02-08 16:44:54 +0100
commit2c75859cbcfcd7b9ee667a7fb5436a96e14cb192 (patch)
treee7696afc6f1297cd591a08ad22b43a2703767e92
parentf1d308e6c7a394256d8ede2979c80d57e3868efa (diff)
ell_grid_solve: do not read from possibly-uninitialized boundary layer
-rw-r--r--ell_grid_solve.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ell_grid_solve.c b/ell_grid_solve.c
index f992186..9d50c82 100644
--- a/ell_grid_solve.c
+++ b/ell_grid_solve.c
@@ -419,7 +419,7 @@ static int solve_exact(EGSContext *ctx)
if (!is_bnd[bnd_loc] || bnd->type != MG2D_BC_TYPE_FIXVAL)
continue;
- for (ptrdiff_t bnd_layer = 1; bnd_layer <= ctx->fd_stencil; bnd_layer++)
+ for (ptrdiff_t bnd_layer = 1; bnd_layer < ctx->fd_stencil; bnd_layer++)
for (ptrdiff_t bnd_idx = -(ptrdiff_t)ctx->fd_stencil; bnd_idx < (ptrdiff_t)(bnd_len[0] + ctx->fd_stencil); bnd_idx++) {
e->rhs[mat_row_idx] -= bnd->val[bnd_layer * bnd->val_stride + bnd_idx] * dst[dir * bnd_layer * bnd_stride[1] + bnd_idx * bnd_stride[0]];
dst[dir * bnd_layer * bnd_stride[1] + bnd_idx * bnd_stride[0]] = 0.0;