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.
The calls to
metric_->get_parameter(ix)
inDerivativeExpSquaredKernel
pass valuesix
from 0 to 3, which implicitly assumes that the metric passed to the constructor is of typeAxisAlignedMetric
.If, on the other hand, a metric of type
IsotropicMetric
is passed toDerivativeExpSquaredKernel
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.