Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory access out of bounds in numpy + chrome 89 #1474

Merged
merged 23 commits into from
Apr 17, 2021
Merged
Prev Previous commit
Next Next commit
Fix patch
  • Loading branch information
Hood committed Apr 16, 2021
commit 630cd04aefdd2196faae6a2ce9696564d9b3b324
14 changes: 5 additions & 9 deletions packages/numpy/patches/segfault-PyArray_Broadcast.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ reimplemented the first part of the function in Javascript. See
src/core/numpy_patch.c where we define PyArray_Broadcast_part1.

---
numpy/core/src/multiarray/iterators.c | 33 ++++++++++++++++++++-------
1 file changed, 25 insertions(+), 8 deletions(-)
numpy/core/src/multiarray/iterators.c | 32 +++++++++++++++++++++------
1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
index 9da811f69..a801c221a 100644
index 9da811f69..b59d32da1 100644
--- a/numpy/core/src/multiarray/iterators.c
+++ b/numpy/core/src/multiarray/iterators.c
@@ -1153,17 +1153,16 @@ NPY_NO_EXPORT PyTypeObject PyArrayIter_Type = {
@@ -1153,13 +1153,13 @@ NPY_NO_EXPORT PyTypeObject PyArrayIter_Type = {

/** END of Array Iterator **/

Expand All @@ -41,11 +41,7 @@ index 9da811f69..a801c221a 100644
int i, nd, k, j;
npy_intp tmp;
PyArrayIterObject *it;

/* Discover the broadcast number of dimensions */
for (i = 0, nd = 0; i < mit->numiter; i++) {
nd = PyArray_MAX(nd, PyArray_NDIM(mit->iters[i]->ao));
@@ -1195,6 +1194,24 @@ PyArray_Broadcast(PyArrayMultiIterObject *mit)
@@ -1195,6 +1195,24 @@ PyArray_Broadcast(PyArrayMultiIterObject *mit)
}
}
}
Expand Down