From baad7437aba3bf4f553c505649f350804b5536ff Mon Sep 17 00:00:00 2001 From: Tobias Oberstein Date: Mon, 14 Mar 2022 19:09:38 +0100 Subject: [PATCH] fix zero length strings in key part 2 of UuidStringKeysMixin (#46) --- zlmdb/_types.py | 9 ++++++--- zlmdb/_version.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/zlmdb/_types.py b/zlmdb/_types.py index df63d3e..06783a8 100644 --- a/zlmdb/_types.py +++ b/zlmdb/_types.py @@ -761,9 +761,12 @@ def _serialize_key(self, key1_key2): def _deserialize_key(self, data): assert type(data) == bytes - assert len(data) > 16 - data1, data2 = data[:16], data[16:] - + assert len(data) >= 16 + data1 = data[:16] + if len(data) > 16: + data2 = data[16:] + else: + data2 = b'' return uuid.UUID(bytes=data1), data2.decode('utf8') diff --git a/zlmdb/_version.py b/zlmdb/_version.py index 69de965..a0f3b36 100644 --- a/zlmdb/_version.py +++ b/zlmdb/_version.py @@ -24,4 +24,4 @@ # ############################################################################### -__version__ = '22.3.1.dev1' +__version__ = '22.3.1.dev2'