Skip to content

Commit 9807068

Browse files
committed
Merge pull request #5168 from jkseppan/fix-5105-again
FIX: a bounds check
2 parents 2184f63 + 09fa9a9 commit 9807068

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/numpy_cpp.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ class array_view_accessors<AV, T, 3>
331331

332332
};
333333

334+
// When adding instantiations of array_view_accessors, remember to add entries
335+
// to zeros[] below.
336+
334337
}
335338

336339
static npy_intp zeros[] = { 0, 0, 0 };
@@ -470,7 +473,7 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
470473

471474
npy_intp dim(size_t i) const
472475
{
473-
if (i > ND) {
476+
if (i >= ND) {
474477
return 0;
475478
}
476479
return m_shape[i];

0 commit comments

Comments
 (0)