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

Compiler allows out-of-bounds indexing, Stan programs seg-faulting #847

Closed
mitzimorris opened this issue Mar 9, 2021 · 2 comments · Fixed by #849
Closed

Compiler allows out-of-bounds indexing, Stan programs seg-faulting #847

mitzimorris opened this issue Mar 9, 2021 · 2 comments · Fixed by #849
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@mitzimorris
Copy link
Member

Stan programs are segfaulting if user gets the indexing wrong.
Here's an example:

data {
  int<lower=0> N;               // number of items
  int<lower=0> M;               // number of predictors
  int<lower=0,upper=1> y[N];           // outcomes
  row_vector[M] x[N];      // predictors
}
transformed data {
  print(x[200,200]);
}

Given input where N=128 and M=2, print statement segfaults. The generated code should be checking bounds sized N,M before allowing access.

2 recent reports coming from CmdStanPy users confused by return code -11 -
https://discourse.mc-stan.org/t/cmdstanpy-error-code-11/21051/3
stan-dev/docs#228 (comment)

@mitzimorris mitzimorris added the bug Something isn't working label Mar 9, 2021
@bbbales2
Copy link
Member

bbbales2 commented Mar 9, 2021

I think this is the same bug as #776.

@mitzimorris mitzimorris added the duplicate This issue or pull request already exists label Mar 10, 2021
@mitzimorris
Copy link
Member Author

agreed, same bug as #776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants