You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4836e24
Browse filesBrowse the repository at this point in the historyBrowse files
Check the dimension of runtime shapes given to xtensor
The shape of an xtensor<T, N> is a std::array<std::size_t, N>. resize()
checks that a runtime shape has N values, but from_shape() only had an
XTENSOR_ASSERT, off in release builds, and reshape() had no check. A
shape of the wrong length was copied past the std::array, a
stack-buffer-overflow, as in
xtensor<double, 1>::from_shape(std::vector<std::size_t>{2, 3}).
interp() builds its xtensor<T, 1> result with from_shape(x.shape()), so
a 2-D x overflowed the same way, and a 0-D x gave a result with an
uninitialized shape. It also read a 2-D xp or a short fp out of bounds.
from_shape() and both reshape() overloads now use the same
XTENSOR_PRECONDITION as resize(). interp() checks up front that x, xp
and fp are 1-D, that xp is not empty and that fp has the length of xp.
This removes the GCC 13 and 15 -Warray-bounds and -Wmaybe-uninitialized
warnings on the copy into the shape in from_shape(), reached from
interp() in test_extended_xmath_interp.
0 commit comments