summaryrefslogtreecommitdiff
path: root/dev-python/cbor2/files/cbor2-5.6.1-cext.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/cbor2/files/cbor2-5.6.1-cext.patch')
-rw-r--r--dev-python/cbor2/files/cbor2-5.6.1-cext.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/dev-python/cbor2/files/cbor2-5.6.1-cext.patch b/dev-python/cbor2/files/cbor2-5.6.1-cext.patch
new file mode 100644
index 000000000000..1695038e4b42
--- /dev/null
+++ b/dev-python/cbor2/files/cbor2-5.6.1-cext.patch
@@ -0,0 +1,40 @@
+From 4de6991ba29bf2290d7b9d83525eda7d021873df Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= <alex.gronholm@nextday.fi>
+Date: Sat, 3 Feb 2024 13:03:38 +0200
+Subject: [PATCH] Check PyObject_Hash() return value for errors
+
+Fixes #213.
+---
+ docs/versionhistory.rst | 5 +++++
+ source/tags.c | 2 ++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst
+index 70948c5..c91cdd0 100644
+--- a/docs/versionhistory.rst
++++ b/docs/versionhistory.rst
+@@ -5,6 +5,11 @@ Version history
+
+ This library adheres to `Semantic Versioning <http://semver.org/>`_.
+
++**UNRELEASED**
++
++- Fixed ``__hash__()`` of the C version of the ``CBORTag`` type crashing when there's a recursive
++ reference cycle
++
+ **5.6.1** (2024-02-01)
+
+ - Fixed use-after-free in the decoder's C version when prematurely encountering the end of stream
+diff --git a/source/tags.c b/source/tags.c
+index b718f55..ceb0916 100644
+--- a/source/tags.c
++++ b/source/tags.c
+@@ -182,6 +182,8 @@ CBORTag_hash(CBORTagObject *self)
+ goto exit;
+
+ ret = PyObject_Hash(tmp);
++ if (ret == -1)
++ goto exit;
+
+ // Remove id(self) from thread_locals.running_hashes
+ if (PySet_Discard(running_hashes, self_id) == -1) {