You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pyexpat: CPython can be crashed through resetting StartDoctypeDeclHandler with pyexpat at the wrong time #160442
It has been brought to my attention that the Expat XML parser can be crashed via a segmentation fault by resetting member StartDoctypeDeclHandler at the wrong time, like this:
fromxml.parsers.expatimportParserCreateparser=ParserCreate()
defreset_start_doctype_handler():
parser.StartDoctypeDeclHandler=NonereturnTrueparser.StartDoctypeDeclHandler=lambda*_: Noneparser.NotStandaloneHandler=reset_start_doctype_handlerparser.Parse(b"<!DOCTYPE r SYSTEM \"s\"><r/>", True)
This affects all versions of Python with all versions of Expat up to 2.9.0 including. Expat upstream pull request libexpat/libexpat#1437 fixes this issue for itself and CPython and the fix will be contained in the next release that may come out as early as next Monday. So updating to the next release will fix this for Python for free, I just wanted to let you know.
Bartłomiej reported this as defense-in-depth to me and we both do not consider this a vulnerability. If you come to difference conclusions, please let me know.
Activity