Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ This release is compatible with NumPy 2.5.
* Fixed `dpnp.bincount` raising a `ValueError` on an empty input array instead of returning an empty `intp` array [#3018](https://github.com/IntelPython/dpnp/pull/3018)
* Fixed `dpnp.tensor.top_k` aborting for `k=0` by returning empty result arrays without launching a zero-sized kernel [#3022](https://github.com/IntelPython/dpnp/pull/3022)
* Fixed comparison functions (`dpnp.equal`, `dpnp.not_equal`, `dpnp.less`, `dpnp.less_equal`, `dpnp.greater`, `dpnp.greater_equal`) and `dpnp.divide` raising `OverflowError` when comparing an integer array against a Python integer scalar outside the array dtype's range [#3017](https://github.com/IntelPython/dpnp/pull/3017)
* Fixed a crash in boolean-mask advanced indexing (`dpnp.ndarray` get/set item) when the selection is empty (e.g. a scalar `False` index that injects a length-0 axis) [#3019](https://github.com/IntelPython/dpnp/pull/3019)

### Security

Expand Down
10 changes: 10 additions & 0 deletions dpnp/tensor/libtensor/source/boolean_advanced_indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ std::pair<sycl::event, sycl::event>
throw py::value_error("Inconsistent array dimensions");
}

if (ortho_nelems == 0 || masked_src_nelems == 0) {
// nothing to do
return std::make_pair(sycl::event(), sycl::event());
}

dpnp::tensor::validation::AmpleMemory::throw_if_not_ample(
dst, ortho_nelems * masked_dst_nelems);

Expand Down Expand Up @@ -542,6 +547,11 @@ std::pair<sycl::event, sycl::event>
throw py::value_error("Inconsistent array dimensions");
}

if (ortho_nelems == 0 || masked_dst_nelems == 0) {
// nothing to do
return std::make_pair(sycl::event(), sycl::event());
}

dpnp::tensor::validation::AmpleMemory::throw_if_not_ample(
dst, ortho_nelems * masked_dst_nelems);

Expand Down
Loading