summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2021-09-18 21:14:45 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2021-09-18 21:14:45 +0300
commit57ea44b8b8fdc2c57c3f8e0e328d12d2cecb3add (patch)
tree1dcd21e36a48f634d2a63811d110a3cfd571055e /dev-python/sabyenc
parentdev-libs/libgcrypt: drop 1.8.6, 1.9.1-r1, 1.9.2, 1.9.3 (diff)
downloadgentoo-57ea44b8b8fdc2c57c3f8e0e328d12d2cecb3add.tar.gz
gentoo-57ea44b8b8fdc2c57c3f8e0e328d12d2cecb3add.tar.bz2
gentoo-57ea44b8b8fdc2c57c3f8e0e328d12d2cecb3add.zip
dev-python/sabyenc: fix segfault, enable py3.10
Closes: https://bugs.gentoo.org/736224 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python/sabyenc')
-rw-r--r--dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch28
-rw-r--r--dev-python/sabyenc/sabyenc-4.0.2.ebuild17
2 files changed, 38 insertions, 7 deletions
diff --git a/dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch b/dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch
new file mode 100644
index 000000000000..1a80d5f13da8
--- /dev/null
+++ b/dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch
@@ -0,0 +1,28 @@
+From: Arthur Zamarin <arthurzam@gmail.com>
+Date: Sat, 18 Sep 2021 21:07:45 +0300
+Subject: Fix Segfault during testing
+
+decode_usenet_chunks might receive it argument as bytesarray, or
+as bytes object, but the C code expects only bytesarray.
+Add code, to apply variant for each case, and fail using assert when
+both don't apply.
+
+Signed-off-by: Arthur Zamarin <arthurzam@gmail.com>
+
+--- a/src/sabyenc3.c
++++ b/src/sabyenc3.c
+@@ -593,7 +593,13 @@ PyObject* decode_usenet_chunks(PyObject* self, PyObject* args) {
+ num_bytes_reserved = 0;
+ lp_max = (int)PyList_Size(Py_input_list);
+ for(lp = 0; lp < lp_max; lp++) {
+- num_bytes_reserved += (int)PyByteArray_GET_SIZE(PyList_GetItem(Py_input_list, lp));
++ PyObject *temp = PyList_GetItem(Py_input_list, lp);
++ if (PyByteArray_Check(temp))
++ num_bytes_reserved += (int)PyByteArray_GET_SIZE(temp);
++ else if (PyBytes_Check(temp))
++ num_bytes_reserved += (int)PyBytes_GET_SIZE(temp);
++ else
++ assert(PyByteArray_Check(temp) || PyBytes_Check(temp));
+ }
+ }
+
diff --git a/dev-python/sabyenc/sabyenc-4.0.2.ebuild b/dev-python/sabyenc/sabyenc-4.0.2.ebuild
index f777975da68e..d9536017b50b 100644
--- a/dev-python/sabyenc/sabyenc-4.0.2.ebuild
+++ b/dev-python/sabyenc/sabyenc-4.0.2.ebuild
@@ -1,8 +1,9 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI="7"
-PYTHON_COMPAT=( python3_{7,8,9} )
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1
@@ -13,13 +14,15 @@ SRC_URI="https://github.com/sabnzbd/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="amd64 ~x86"
-IUSE="test"
-RESTRICT="!test? ( test )"
-
-DOCS=( CHANGES.md README.md doc/yenc-draft.1.3.txt )
-DEPEND="test? (
+BDEPEND="test? (
dev-python/chardet[${PYTHON_USEDEP}]
)"
+DOCS=( CHANGES.md README.md doc/yenc-draft.1.3.txt )
+
+PATCHES=(
+ "${FILESDIR}/${P}-fix-segfault.patch"
+)
+
distutils_enable_tests pytest