diff --git a/backport-CVE-2021-41496.patch b/backport-CVE-2021-41496.patch new file mode 100644 index 0000000000000000000000000000000000000000..fe7ae45af05e291cc80521b71d7fc06c74cd111e --- /dev/null +++ b/backport-CVE-2021-41496.patch @@ -0,0 +1,60 @@ +From 271010f1037150e95017f803f4214b8861e528f2 Mon Sep 17 00:00:00 2001 +From: Warren Weckesser +Date: Mon, 20 Dec 2021 10:35:31 -0500 +Subject: [PATCH] BUG: f2py: Simplify creation of an exception message. Closes + gh-19000. + +--- + numpy/f2py/src/fortranobject.c | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c +index 4a981bf..d323878 100644 +--- a/numpy/f2py/src/fortranobject.c ++++ b/numpy/f2py/src/fortranobject.c +@@ -595,14 +595,14 @@ static int check_and_fix_dimensions(const PyArrayObject* arr, + npy_intp *dims); + + static int +-count_negative_dimensions(const int rank, +- const npy_intp *dims) { +- int i=0,r=0; +- while (i 0) { +- int i; +- strcpy(mess, "failed to create intent(cache|hide)|optional array" +- "-- must have defined dimensions but got ("); +- for(i=0;i= 0) { ++ PyErr_Format(PyExc_ValueError, ++ "failed to create intent(cache|hide)|optional array" ++ " -- must have defined dimensions, but dims[%d] = %" ++ NPY_INTP_FMT, i, dims[i]); + return NULL; + } + arr = (PyArrayObject *) +-- +2.27.0 + diff --git a/numpy.spec b/numpy.spec index 09f7245e89bdf84b1f1e2fc8836a2ae46a6a7535..ea7bf4503416ee36fd11f827d5a7e02f24a563e4 100644 --- a/numpy.spec +++ b/numpy.spec @@ -2,7 +2,7 @@ Name: numpy Version: 1.21.4 -Release: 1 +Release: 2 Epoch: 1 Summary: A fast multidimensional array facility for Python @@ -14,6 +14,8 @@ BuildRequires: openblas-devel BuildRequires: lapack-devel gcc-gfortran BuildRequires: python3-Cython >= 0.29.24 +Patch0: backport-CVE-2021-41496.patch + %description NumPy is the fundamental package for scientific computing with Python. It contains among other things: a powerful N-dimensional array object @@ -102,6 +104,9 @@ popd &> /dev/null %changelog +* Wed Jan 05 2022 yuanxin - 1.21.4-2 +- fix CVE-2021-41496 + * Mon Dec 13 2021 shixuantong - 1.21.4-1 - update version to 1.21.4