-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
Fix index-out-of-bounds in gp_matern32_cov #3084
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Maybe we should start suggesting/requiring range-based loops where possible instead to avoid this?
That would be nice where it's possible. I wonder if there is a linter rule we could turn on, because enforcing it manually seems impossible to do consistently. |
Thank you for the fast fix! |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Thank you for the fast fix on this issue, @WardBrian. Do you know when these changes are expected to be released in an upcoming cmdstan version? cc @skiptoniam |
@tillahoffmann the next release is scheduled for October 7th |
Great, thank you! |
Summary
Reported by @tillahoffmann on the forums: https://discourse.mc-stan.org/t/debugging-gp-matern32-cov/35502.
One of the overloads of
gp_matern32_cov
was usingx_size
to index over a variable that actually had lengthl_size
. Presumably a copy/paste error.Tests
I added a minified version of their reproducer. The behavior is undefined in the bug case, so unfortunately the test is not guaranteed to fail on all systems if the bug is re-introduced.
Side Effects
None
Release notes
Fixed an indexing bug inside gp_matern32_cov
Checklist
Copyright holder: Simons Foundation
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested