Update to 4.4.0 - Closes rhbz#2239307
This commit is contained in:
parent
8e66c543d2
commit
74b0957ee0
3 changed files with 8 additions and 83 deletions
75
238.patch
75
238.patch
|
|
@ -1,75 +0,0 @@
|
|||
From a7b3035175488cd26791cd7f935eb1ed03de304a Mon Sep 17 00:00:00 2001
|
||||
From: "Victor M. Alvarez" <plusvic@gmail.com>
|
||||
Date: Wed, 2 Aug 2023 14:42:32 +0200
|
||||
Subject: [PATCH] Fix segfault in Python 3.12b4
|
||||
|
||||
In `flo_read` and `flo_write` there were calls to `Py_DECREF` after releasing the GIL.
|
||||
|
||||
Closes #237
|
||||
---
|
||||
yara-python.c | 34 ++++++++++++++++------------------
|
||||
1 file changed, 16 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/yara-python.c b/yara-python.c
|
||||
index 1d851b9..714317c 100644
|
||||
--- a/yara-python.c
|
||||
+++ b/yara-python.c
|
||||
@@ -1394,29 +1394,28 @@ static size_t flo_read(
|
||||
PyObject* bytes = PyObject_CallMethod(
|
||||
(PyObject*) user_data, "read", "n", (Py_ssize_t) size);
|
||||
|
||||
- PyGILState_Release(gil_state);
|
||||
-
|
||||
- if (bytes != NULL)
|
||||
+ if (bytes == NULL)
|
||||
{
|
||||
- Py_ssize_t len;
|
||||
- char* buffer;
|
||||
-
|
||||
- int result = PyBytes_AsStringAndSize(bytes, &buffer, &len);
|
||||
+ PyGILState_Release(gil_state);
|
||||
+ return i;
|
||||
+ }
|
||||
|
||||
- if (result == -1 || (size_t) len < size)
|
||||
- {
|
||||
- Py_DECREF(bytes);
|
||||
- return i;
|
||||
- }
|
||||
+ Py_ssize_t len;
|
||||
+ char* buffer;
|
||||
|
||||
- memcpy((char*) ptr + i * size, buffer, size);
|
||||
+ int result = PyBytes_AsStringAndSize(bytes, &buffer, &len);
|
||||
|
||||
- Py_DECREF(bytes);
|
||||
- }
|
||||
- else
|
||||
+ if (result == -1 || (size_t) len < size)
|
||||
{
|
||||
+ Py_DECREF(bytes);
|
||||
+ PyGILState_Release(gil_state);
|
||||
return i;
|
||||
}
|
||||
+
|
||||
+ memcpy((char*) ptr + i * size, buffer, size);
|
||||
+
|
||||
+ Py_DECREF(bytes);
|
||||
+ PyGILState_Release(gil_state);
|
||||
}
|
||||
|
||||
return count;
|
||||
@@ -1444,12 +1443,11 @@ static size_t flo_write(
|
||||
(PyObject*) user_data, "write", "s#", (char*) ptr + i * size, size);
|
||||
#endif
|
||||
|
||||
+ Py_XDECREF(result);
|
||||
PyGILState_Release(gil_state);
|
||||
|
||||
if (result == NULL)
|
||||
return i;
|
||||
-
|
||||
- Py_DECREF(result);
|
||||
}
|
||||
|
||||
return count;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Name: python-yara
|
||||
Version: 4.3.1
|
||||
%global baserelease 4
|
||||
Version: 4.4.0
|
||||
%global baserelease 1
|
||||
Summary: Python binding for the YARA pattern matching tool
|
||||
License: Apache-2.0
|
||||
URL: https://github.com/VirusTotal/yara-python/
|
||||
|
|
@ -14,8 +14,8 @@ VCS: https://github.com/VirusTotal/yara-python/
|
|||
|
||||
%global gituser VirusTotal
|
||||
%global gitname yara-python
|
||||
%global commit 37dcb76cd5a07c62e6ed2646968c496e22e70729
|
||||
%global gitdate 20230421
|
||||
%global commit 0dd0ed3fc513cbe1a22b7ca57c2469f37c502771
|
||||
%global gitdate 20230917
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
|
||||
|
||||
|
|
@ -40,9 +40,6 @@ Release: %{baserelease}.%{gitdate}git%{shortcommit}%{?dist}
|
|||
Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz#/%{name}-%{version}-git%{gitdate}-%{shortcommit}.tar.gz
|
||||
%endif
|
||||
|
||||
# https://github.com/VirusTotal/yara-python/pull/238
|
||||
Patch0: 238.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: pkgconfig(yara)
|
||||
BuildRequires: libtool
|
||||
|
|
@ -153,6 +150,9 @@ pytest-3 -k "$EXCLUDE" tests.py -v
|
|||
|
||||
#====================================================================
|
||||
%changelog
|
||||
* Sun Sep 17 2023 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 4.4.0-1
|
||||
- bump to 4.4.0
|
||||
|
||||
* Fri Aug 25 2023 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 4.3.1-4
|
||||
- Fix rhbz#2226378 rhbz#2220571
|
||||
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (python-yara-4.3.1.tar.gz) = 78cd53f756967ef79cc742acffaeea53631ee475c07efd1506eba7e0630b2e570ba03686da1fa3247c9339faa67daf6c372913731b73233626661c0a9f575e41
|
||||
SHA512 (python-yara-4.4.0.tar.gz) = bc72c2f65e3fe3d7f94728565143b787df6cc63313a3e8b9f159a5cfc3c947f5233674a1213fd2c6454f6165b676da366319794f9fa7c695c43e5523c29a1432
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue