dev-python/hiredis: Revision bump for CVE-2021-32765

It includes a bundled copy of dev-libs/hiredis and is suffering the same
security issue.

URL: https://github.com/redis/hiredis/security/advisories/GHSA-hfm9-39pp-55p2
Bug: https://bugs.gentoo.org/816318
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Sven Wegener <swegener@gentoo.org>
This commit is contained in:
Sven Wegener
2021-10-31 13:34:29 +01:00
parent 4ede8ab965
commit a0e1a56eed
2 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
--- a/vendor/hiredis/alloc.c
+++ b/vendor/hiredis/alloc.c
@@ -68,6 +68,10 @@ void *hi_malloc(size_t size) {
}
void *hi_calloc(size_t nmemb, size_t size) {
+ /* Overflow check as the user can specify any arbitrary allocator */
+ if (SIZE_MAX / size < nmemb)
+ return NULL;
+
return hiredisAllocFns.callocFn(nmemb, size);
}
diff --git a/alloc.h b/alloc.h
index 34a05f4..771f9fe 100644
--- a/vendor/hiredis/alloc.h
+++ b/vendor/hiredis/alloc.h
@@ -32,6 +32,7 @@
#define HIREDIS_ALLOC_H
#include <stddef.h> /* for size_t */
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -59,6 +60,10 @@ static inline void *hi_malloc(size_t size) {
}
static inline void *hi_calloc(size_t nmemb, size_t size) {
+ /* Overflow check as the user can specify any arbitrary allocator */
+ if (SIZE_MAX / size < nmemb)
+ return NULL;
+
return hiredisAllocFns.callocFn(nmemb, size);
}

View File

@@ -0,0 +1,36 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{8..10} pypy3 )
inherit distutils-r1
DESCRIPTION="Python extension that wraps hiredis"
HOMEPAGE="https://github.com/redis/hiredis-py/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="system-libs"
DEPEND="system-libs? ( >=dev-libs/hiredis-1.0.0:= )"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}"/${P}-CVE-2021-32765.patch
)
src_prepare() {
use system-libs && PATCHES+=(
"${FILESDIR}"/${P}-system-libs.patch
)
sed -i -e 's:description-file:description_file:' setup.cfg || die
default
}
python_test() {
cd test || die
"${EPYTHON}" -m unittest -v reader.ReaderTest || die "tests failed"
}