diff --git a/fix-pyxdecref-uninit-pointer.patch b/fix-pyxdecref-uninit-pointer.patch new file mode 100644 index 0000000..8188ecc --- /dev/null +++ b/fix-pyxdecref-uninit-pointer.patch @@ -0,0 +1,24 @@ +From ee1a87bc489f14681dacd3fdc518dd40bbab81ea Mon Sep 17 00:00:00 2001 +From: Charalampos Stratakis +Date: Fri, 12 Dec 2025 19:54:48 +0100 +Subject: [PATCH] Initialize interned_fields to NULL + +This avoids a code path where Py_XDECREF could be used on +interned_fields when uninitialized. +--- + src/c/_cffi_backend.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/c/_cffi_backend.c b/src/c/_cffi_backend.c +index 835e3318..6087e635 100644 +--- a/src/c/_cffi_backend.c ++++ b/src/c/_cffi_backend.c +@@ -5152,7 +5152,7 @@ static PyObject *b_complete_struct_or_union_lock_held(CTypeDescrObject *ct, + Py_ssize_t byteoffsetorg; + CFieldObject **previous; + int prev_bitfield_size, prev_bitfield_free; +- PyObject *interned_fields; ++ PyObject *interned_fields = NULL; + + sflags = complete_sflags(sflags); + if (sflags & SF_PACKED) diff --git a/python3.14-cffi.spec b/python3.14-cffi.spec index f3bc4c9..84f4dca 100644 --- a/python3.14-cffi.spec +++ b/python3.14-cffi.spec @@ -10,6 +10,11 @@ License: MIT AND PSF-2.0 URL: https://github.com/python-cffi/cffi Source: %{url}/archive/v%{version}/cffi-%{version}.tar.gz +# Fix coverity scan issue +# Possibility of using Py_XDECREF on an uninitialized pointer +# Resolved upstream: https://github.com/python-cffi/cffi/pull/221 +Patch: fix-pyxdecref-uninit-pointer.patch + BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: make