cpython: a2688e252204 (original) (raw)

Mercurial > cpython

changeset 70451:a2688e252204 3.1

Issue #985064: Make plistlib more resilient to faulty input plists. Patch by Mher Movsisyan. [#985064]

Ned Deily nad@acm.org
date Sat, 28 May 2011 02:19:19 -0700
parents 0cded2f2cea3
children f555d959a5d7 bd49031b9488
files Lib/plistlib.py Lib/test/test_plistlib.py Misc/ACKS Misc/NEWS
diffstat 4 files changed, 67 insertions(+), 22 deletions(-)[+] [-] Lib/plistlib.py 59 Lib/test/test_plistlib.py 26 Misc/ACKS 1 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/plistlib.py +++ b/Lib/plistlib.py @@ -68,13 +68,15 @@ def readPlist(pathOrFile): usually is a dictionary). """ didOpen = False

def readPlistFromBytes(data): @@ -352,7 +356,6 @@ class Data: def repr(self): return "%s(%s)" % (self.class.name, repr(self.data)) - class PlistParser: def init(self): @@ -362,11 +365,11 @@ class PlistParser: def parse(self, fileobj): from xml.parsers.expat import ParserCreate

def handleBeginElement(self, element, attrs): @@ -385,12 +388,18 @@ class PlistParser: def addObject(self, value): if self.currentKey is not None:

def getData(self): @@ -405,9 +414,15 @@ class PlistParser: self.addObject(d) self.stack.append(d) def end_dict(self):

def end_key(self):

def begin_array(self, attrs):

--- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -175,6 +175,32 @@ class TestPlistlib(unittest.TestCase): self.assertEqual(test1, result1) self.assertEqual(test2, result2)

+

+

+

+ def test_main(): support.run_unittest(TestPlistlib)

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -563,6 +563,7 @@ Skip Montanaro Paul Moore Derek Morr James A Morrison +Mher Movsisyan Sjoerd Mullender Sape Mullender Michael Muller

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -80,6 +80,9 @@ Core and Builtins Library ------- +- Issue #985064: Make plistlib more resilient to faulty input plists.