Skip to content

Commit

Permalink
Merge pull request #1355 from meejah/4087.cbor2-encoding
Browse files Browse the repository at this point in the history
blacklist cbor2 version
  • Loading branch information
meejah committed Jan 20, 2024
2 parents 19538e3 + 52a27a6 commit 2cc9cea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Empty file added newsfragments/4087.bugfix
Empty file.
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions src/allmydata/test/test_storage_http.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)))
)

0 comments on commit 2cc9cea

Please sign in to comment.