diff options
| author | Fred Drake <fdrake@acm.org> | 2006-07-01 16:28:20 (GMT) |
|---|---|---|
| committer | Fred Drake <fdrake@acm.org> | 2006-07-01 16:28:20 (GMT) |
| commit | 6ffe499397acfe916202e3e46adfa868e6a307b9 (patch) | |
| tree | 4b6104be38e351c8d9bf0ba5d22ba4dac287d08f /Lib/test/test_pyexpat.py | |
| parent | 7596e8342ea34108d773d1802d5147e9884b547f (diff) | |
| download | cpython-6ffe499397acfe916202e3e46adfa868e6a307b9.zip cpython-6ffe499397acfe916202e3e46adfa868e6a307b9.tar.gz cpython-6ffe499397acfe916202e3e46adfa868e6a307b9.tar.bz2 | |
SF bug #1296433 (Expat bug #1515266): Unchecked calls to character data
handler would cause a segfault. This merges in Expat's lib/xmlparse.c
revisions 1.154 and 1.155, which fix this and a closely related problem
(the later does not affect Python).
Moved the crasher test to the tests for xml.parsers.expat.
Diffstat (limited to 'Lib/test/test_pyexpat.py')
| -rw-r--r-- | Lib/test/test_pyexpat.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py index a9a5e8f..0698818 100644 --- a/Lib/test/test_pyexpat.py +++ b/Lib/test/test_pyexpat.py @@ -365,3 +365,24 @@ parser.Parse('''<a> <c/> </b> </a>''', 1) + + +def test_parse_only_xml_data(): + # http://python.org/sf/1296433 + # + xml = "<?xml version='1.0' encoding='iso8859'?><s>%s</s>" % ('a' * 1025) + # this one doesn't crash + #xml = "<?xml version='1.0'?><s>%s</s>" % ('a' * 10000) + + def handler(text): + raise Exception + + parser = expat.ParserCreate() + parser.CharacterDataHandler = handler + + try: + parser.Parse(xml) + except: + pass + +test_parse_only_xml_data() |
