From 6b7d1e985c6f84db185d31483fa16c1e76eef829 Mon Sep 17 00:00:00 2001 From: meejah Date: Fri, 19 Jan 2024 12:09:20 -0700 Subject: [PATCH 1/3] test for 4087 --- src/allmydata/test/test_storage_http.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/allmydata/test/test_storage_http.py b/src/allmydata/test/test_storage_http.py index dba7ee5d2b..5dfb7573ba 100644 --- a/src/allmydata/test/test_storage_http.py +++ b/src/allmydata/test/test_storage_http.py @@ -41,6 +41,7 @@ from werkzeug.exceptions import NotFound as WNotFound from testtools.matchers import Equals from zope.interface import implementer +import cbor2 from ..util.deferredutil import async_to_deferred from ..util.cputhreadpool import disable_thread_pool_for_test @@ -1835,3 +1836,14 @@ def test_read_with_no_range(self, data_length): A read with no range returns the whole mutable. """ return self._read_with_no_range_test(data_length) + + def test_roundtrip_cbor2_encoding_issue(self): + """ + Some versions of cbor2 (5.6.0) don't correctly encode bytestrings + bigger than 65535 + """ + for size in range(0, 65535*2, 17): + self.assertEqual( + size, + len(cbor2.loads(cbor2.dumps(b"\12" * size))) + ) From 741f6182f8a9494d834ee499e5c9571e93cbfe58 Mon Sep 17 00:00:00 2001 From: meejah Date: Fri, 19 Jan 2024 12:10:13 -0700 Subject: [PATCH 2/3] exclude cbor2 5.6.0 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a6b4cb9610..34d436a49e 100644 --- a/setup.py +++ b/setup.py @@ -143,7 +143,8 @@ def read_version_py(infname): # 2.2.0 has a bug: https://github.com/pallets/werkzeug/issues/2465 "werkzeug != 2.2.0", "treq", - "cbor2", + # 5.6.0 excluded because https://github.com/agronholm/cbor2/issues/208 + "cbor2 != 5.6.0", # 0.4 adds the ability to pass in mmap() values which greatly reduces the # amount of copying involved. From 52a27a6fa14c5cac993f2732d095249b01ca3c33 Mon Sep 17 00:00:00 2001 From: meejah Date: Fri, 19 Jan 2024 12:10:38 -0700 Subject: [PATCH 3/3] news --- newsfragments/4087.bugfix | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/4087.bugfix diff --git a/newsfragments/4087.bugfix b/newsfragments/4087.bugfix new file mode 100644 index 0000000000..e69de29bb2