-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Issues with binary plists #76253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
plistlib creates a new objects when read references instead of using As result it doesn't preserve identity: >>> import plistlib
>>> a = [['spam']]*2
>>> a[0] is a[1]
True
>>> b = plistlib.loads(plistlib.dumps(a, fmt=plistlib.FMT_BINARY))
>>> b == a
True
>>> b[0] is b[1]
False And plistlib.loads() is vulnerable to plists containing cyclic plistlib.dumps() preserves reference in the output, but it saves
Security issues affect you only when you load plists from untrusted sources. Adding the proper support of references could be considered a new |
Ronald, could you please make a review? I want to merge this before 3.7.0a3. |
For example: a = []
for i in range(22):
a = [a, a]
b = plistlib.dumps(a, fmt=plistlib.FMT_BINARY) The result is 130 bytes long on patched plistlib. But plistlib.dumps(b) will expand to a structure consuming almost a gigabyte of memory on unpatched plistlib. Increasing the level of nesting by one will duplicate memory consumption, so it is easy to consume all available memory on any computer. |
Thanks Larry. |
Thank you for the fix! I just wish I knew what plists were ;-) |
@larry: plists are Apple's equivalent to Windows INI files ;-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: