We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2be98b4 commit 26e9c7eCopy full SHA for 26e9c7e
include/xtensor/views/xstrided_view_base.hpp
@@ -903,6 +903,14 @@ namespace xt
903
if (ptr != nullptr)
904
{
905
auto slice0 = static_cast<old_strides_value_type>(*ptr);
906
+ if (slice0 < 0)
907
+ {
908
+ slice0 += shape[i_ax];
909
+ }
910
+ if (slice0 < 0 || slice0 >= shape[i_ax])
911
912
+ XTENSOR_THROW(std::runtime_error, "Slice index out of range.");
913
914
new_offset += static_cast<std::size_t>(slice0 * old_strides[i_ax]);
915
}
916
else if (std::get_if<xt::xnewaxis_tag>(&slices[i]) != nullptr)
0 commit comments