Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Boolean indexing accesses out of bound elements #17990

@leezu

Description

@leezu

Description

CI with updated toolchain (ie #17984) catches the bug.

vector: :_M_range_check: __n (which is 2) >= this->size() (which is 2)

Error Message

To Reproduce

Build with this simple patch

diff --git a/src/operator/numpy/np_boolean_mask_assign.cc b/src/operator/numpy/np_boolean_mask_assign.cc
index e01ebb7c6..d5ab00835 100644
--- a/src/operator/numpy/np_boolean_mask_assign.cc
+++ b/src/operator/numpy/np_boolean_mask_assign.cc
@@ -220,7 +220,7 @@ void NumpyBooleanAssignForwardCPU(const nnvm::NodeAttrs& attrs,
   // If there's no True in mask, return directly
   if (valid_num == 0) return;

-  const TShape& vshape = inputs[2].shape_;
+  const TShape& vshape = inputs.at(2).shape_;

   if (inputs.size() == 3U) {
     // tensor case

OR follow the instructions in #17987 to trigger this via glibc assertions in debug build.

Run test_np_ndarray_boolean_indexing, test_npx_batch_dot or test_npi_boolean_assign to trigger the bug.

CC: @haojin2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions