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

Make consistent indexing of metric parameters in DerivativeExpSquaredKernel #6

Open
mdschneider opened this issue Aug 16, 2015 · 2 comments
Assignees
Labels

Comments

@mdschneider
Copy link
Collaborator

The calls to metric_->get_parameter(ix) in DerivativeExpSquaredKernel pass values ix from 0 to 3, which implicitly assumes that the metric passed to the constructor is of type AxisAlignedMetric.

If, on the other hand, a metric of type IsotropicMetric is passed to DerivativeExpSquaredKernel then there will be memory access outside of the allocated memory for the metric parameter vector (unless the std::vector bounds checking is used).

A simple solution would be to remove the template type for the metric member variable. But this then doesn't match the interface of existing george kernels.

A more complete solution would do some checking of the metric subclass type before passing indexes to the get_parameter method of the metric object.

@mdschneider
Copy link
Collaborator Author

I should have specified this is all about the C++ layer of george.

@karenyyng
Copy link
Owner

Thanks @mdschneider. I agree with the type checking of the metric subclass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants