Internal issue with DataView
iterator increment operator when size along at least one axis is zero
#1621
Labels
bug
Something isn't working
We discovered this issue with the
DataView
iterator increment operator when putting together #1598:catalyst/runtime/include/DataView.hpp
Lines 56 to 72 in 46d839e
See the comment here for more details.
In short, when the size along at least one axis of the data view is zero, there's an issue with the multidimensional indexing computation that results in the
loc
variable increasing indefinitely until the program segfaults. Specifically, the issue is thatview.sizes[idx] == 0
withidx == 1
on the first iteration, resulting in an underflow error when subtracting 1 from it (sinceview.sizes
is of typesize_t
). We added an assert in #1598 to ensure that the iteration terminates before an underflow error occurs, but the original issue with the multidimensional indexing should be fixed properly.As far as we are aware, there are no user-facing or internal functions that will trigger this error. To reproduce it, you can modify the
NullQubit::Sample()
function to the followingand execute the following workload:
The text was updated successfully, but these errors were encountered: