Fix UBSan report in arrayCumSum

This commit is contained in:
Alexey Milovidov 2021-02-06 22:21:22 +03:00
parent fd899daa00
commit 65902f4c6e

View File

@ -53,7 +53,7 @@ struct ArrayCumSumImpl
for (const auto * end = offsets + size; offsets < end; ++offsets) for (const auto * end = offsets + size; offsets < end; ++offsets)
{ {
auto offset = *offsets; auto offset = *offsets;
Src accumulated{}; Dst accumulated{};
for (; pos < offset; ++pos) for (; pos < offset; ++pos)
{ {
accumulated += src_value; accumulated += src_value;
@ -70,7 +70,7 @@ struct ArrayCumSumImpl
for (const auto * end = offsets + size; offsets < end; ++offsets) for (const auto * end = offsets + size; offsets < end; ++offsets)
{ {
auto offset = *offsets; auto offset = *offsets;
Src accumulated{}; Dst accumulated{};
for (; pos < offset; ++pos) for (; pos < offset; ++pos)
{ {
accumulated += src_values[pos]; accumulated += src_values[pos];