Serhiy Storchaka added the comment:

The simplest reproducer:

>>> import plistlib
>>> plistlib.loads(plistlib.dumps('\U0001f40d', fmt=plistlib.FMT_BINARY))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/plistlib.py", line 1006, in loads
    fp, fmt=fmt, use_builtin_types=use_builtin_types, dict_type=dict_type)
  File "/usr/lib/python3.5/plistlib.py", line 997, in load
    return p.parse(fp)
  File "/usr/lib/python3.5/plistlib.py", line 623, in parse
    return self._read_object(self._object_offsets[top_object])
  File "/usr/lib/python3.5/plistlib.py", line 704, in _read_object
    return self._fp.read(s * 2).decode('utf-16be')
  File "/usr/lib/python3.5/encodings/utf_16_be.py", line 16, in decode
    return codecs.utf_16_be_decode(input, errors, True)
UnicodeDecodeError: 'utf-16-be' codec can't decode bytes in position 0-1: 
unexpected end of data

Proposed patch fixes this issue.

----------
keywords: +patch
nosy: +ronaldoussoren, serhiy.storchaka
stage:  -> patch review
versions: +Python 2.7, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44901/plistlib-astral-characters.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28321>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to