From cce1048cd066ae7719172d416f19a9514a7909ca Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Jul 2021 16:46:00 -0400 Subject: [PATCH] Backport PR #20645: Fix leak if affine_transform is passed invalid vertices. --- src/_path_wrapper.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index 40b5abb2fd37..2b58aec0cfdd 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -471,17 +471,19 @@ static PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *k if (PyArray_NDIM(vertices_arr) == 2) { numpy::array_view vertices(vertices_arr); + Py_DECREF(vertices_arr); + npy_intp dims[] = { (npy_intp)vertices.size(), 2 }; numpy::array_view result(dims); CALL_CPP("affine_transform", (affine_transform_2d(vertices, trans, result))); - Py_DECREF(vertices_arr); return result.pyobj(); } else { // PyArray_NDIM(vertices_arr) == 1 numpy::array_view vertices(vertices_arr); + Py_DECREF(vertices_arr); + npy_intp dims[] = { (npy_intp)vertices.size() }; numpy::array_view result(dims); CALL_CPP("affine_transform", (affine_transform_1d(vertices, trans, result))); - Py_DECREF(vertices_arr); return result.pyobj(); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy