Issue #21538: The plistlib module now supports loading of binary plist files

when reference or offset size is not a power of two.
This commit is contained in:
Serhiy Storchaka 2014-05-23 16:13:33 +03:00
parent f01fffedd1
commit 065266450e
3 changed files with 28 additions and 6 deletions

View file

@ -411,6 +411,18 @@ class TestPlistlib(unittest.TestCase):
pl2 = plistlib.loads(data)
self.assertEqual(dict(pl), dict(pl2))
def test_nonstandard_refs_size(self):
# Issue #21538: Refs and offsets are 24-bit integers
data = (b'bplist00'
b'\xd1\x00\x00\x01\x00\x00\x02QaQb'
b'\x00\x00\x08\x00\x00\x0f\x00\x00\x11'
b'\x00\x00\x00\x00\x00\x00'
b'\x03\x03'
b'\x00\x00\x00\x00\x00\x00\x00\x03'
b'\x00\x00\x00\x00\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\x13')
self.assertEqual(plistlib.loads(data), {'a': 'b'})
class TestPlistlibDeprecated(unittest.TestCase):
def test_io_deprecated(self):