Latest Results
Fix xview::element when a newaxis precedes an integral slice
make_index maps each dimension i of the underlying expression to its
slice k, then to the position of that slice in the view index:
k minus the number of integral slices before it. It counted the
integral slices before i instead of before k. The two differ when a
newaxis comes before an integral slice, so the wrong index was read:
xt::xarray<int> a = {{0, 1, 2}, {3, 4, 5}};
auto v = xt::view(a, xt::newaxis(), 1, xt::all());
v[{0, 2}]; // returned 3 instead of 5
operator() already used the slice position. element(), and the
operator[] and at-style accesses built on it, now do too.gouarin:fix-xview-element-newaxis Validate the arguments of pad and tile
pad and tile take one value, or one pair of values, per axis of the
expression and index their argument by axis. The sizes were only
checked by XTENSOR_ASSERT, which is off in release builds, and the
limits of each pad mode were not checked at all in release:
- pad with fewer pairs than axes, or pairs with fewer than two values,
read past the end of pad_width (heap-buffer-overflow);
- pad with more pairs than axes ignored the extra ones;
- wrap, periodic and symmetric with a width larger than the axis, or
reflect with a width of at least its size, and edge on an empty
axis, returned uninitialized values;
- tile with more repetitions than axes wrote past the std::array shape
of an xtensor (stack-buffer-overflow), and with fewer it built a
garbage shape;
- tile(e, n) on a 0-D expression wrote to an empty std::vector;
- negative widths or repetitions wrapped around to huge sizes.
These cases now throw std::runtime_error before the result is
allocated. The loops of tile use the dimension of the expression for
every buffer they index, which also removes the GCC 13 -O3
-Wstringop-overflow warning on its slice vector.gouarin:fix-pad-tile-validation Latest Branches
-22%
0%
0%
gouarin:fix-xview-element-newaxis © 2026 CodSpeed Technology