[New-bugs-announce] [issue40381] plistlib doesn't handle poorly-formatted plists

Clay Caviness report at bugs.python.org
Fri Apr 24 15:52:32 EDT 2020


New submission from Clay Caviness <clay at boobah.com>:

Some Info.plist files are poorly formatted. I am using plistlib to read Info.plist file from various .app bundles. On some, plistlib.load raises a ValueError when trying to parse.

Examining one of these Info.plist files, it turns out *it* is poorly formatted, but while python's plistlib is unhappy, it passes "plutil -lint" just fine and "Foundation.NSDictionary.dictionaryWithContentsOfFile_" is happy to read it.

Here's a minimal sample plist file:
"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>An array</key>
  <array>
    <string>a string</string>
<key>A wild key appears!</key>
<string>it has a string</string>
    <string>another string</string>
  </array>
</dict>
</plist>
"""

plistlib (correctly, I think) says that's no good. Apple's tooling just ... changes the key to another string in the array and carries on.

I've attached an actual problematic Info.plist as well.

----------
components: Library (Lib)
files: Info.plist
messages: 367217
nosy: Clay Caviness
priority: normal
severity: normal
status: open
title: plistlib doesn't handle poorly-formatted plists
versions: Python 3.7
Added file: https://bugs.python.org/file49091/Info.plist

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40381>
_______________________________________


More information about the New-bugs-announce mailing list