Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in CVAdataStore #49

Open
lcontento opened this issue Sep 10, 2020 · 2 comments
Open

Segmentation fault in CVAdataStore #49

lcontento opened this issue Sep 10, 2020 · 2 comments
Assignees

Comments

@lcontento
Copy link

For some parameter values I get a segmentation fault while doing adjoint sensitivity analysis.
The problematic point is line 2033 in the following snippet:

sundials/src/cvodes/cvodea.c

Lines 2027 to 2037 in 0c83e0b

i = 1;
do {
flag = CVode(cv_mem, ck_mem->ck_t1, ca_mem->ca_ytmp, &t, CV_ONE_STEP);
if (flag < 0) return(CV_FWD_FAIL);
dt_mem[i]->t = t;
ca_mem->ca_IMstore(cv_mem, dt_mem[i]);
i++;
} while ( sign*(ck_mem->ck_t1 - t) > ZERO );

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.

@lcontento
Copy link
Author

I investigated the matter a bit more. It seems that the software package I use (https://github.com/AMICI-dev/AMICI) is calling functions not in the public API. So maybe when only the public API is used the index i would be guaranteed to be inside the valid bounds (not sure).

@aseyboldt
Copy link

This might be the same issue as #31?

@gardner48 gardner48 self-assigned this Jun 27, 2022
@balos1 balos1 added the triage label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants