llnl / llnl/sundials

Segmentation fault in CVAdataStore

Open
#49 5 comments 0 reactions 1 assignee View on GitHub

@gardner48 is already working on this.

Since Jun 27, 2022.

enhancement pkg-CVODES
Dominant language
C
Stars
686
Forks
167
Avg merge
1d 20h
Merged PRs (30d)
17

Description

For some parameter values I get a segmentation fault while doing adjoint sensitivity analysis.
The problematic point is line 2033 in the following snippet:
https://github.com/LLNL/sundials/blob/0c83e0b3f954673b0cf1419cfde1ed4cb3ea1438/src/cvodes/cvodea.c#L2027-L2037
It seems that the index `i` is not checked for being inside the bounds of the `dt_mem` array.
If I add the check `if (i > ca_mem->ca_nsteps) return(CV_FWD_FAIL);` at the beginning of the loop body the segmentation fault is solved.
However, I am not sure if this is the correct thing to do or if index `i` should always be inside the bounds and the actual problem lies elsewhere.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.