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