[Python-checkins] bpo-45329: Fix freed memory access in pyexpat.c (GH-28649)
miss-islington
webhook-mailer at python.org
Sat Oct 2 09:21:59 EDT 2021
https://github.com/python/cpython/commit/22cf6a2f2347b7d4f11e45e557beace55acc79b5
commit: 22cf6a2f2347b7d4f11e45e557beace55acc79b5
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-10-02T06:21:55-07:00
summary:
bpo-45329: Fix freed memory access in pyexpat.c (GH-28649)
(cherry picked from commit 0742abdc48886b74ed3b66985a54bb1c32802670)
Co-authored-by: TAGAMI Yukihiro <tagami.yukihiro at gmail.com>
files:
A Misc/NEWS.d/next/Library/2021-10-01-13-09-53.bpo-45329.9iMYaO.rst
M Modules/pyexpat.c
diff --git a/Misc/NEWS.d/next/Library/2021-10-01-13-09-53.bpo-45329.9iMYaO.rst b/Misc/NEWS.d/next/Library/2021-10-01-13-09-53.bpo-45329.9iMYaO.rst
new file mode 100644
index 0000000000000..b4bedbc278edf
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-10-01-13-09-53.bpo-45329.9iMYaO.rst
@@ -0,0 +1,2 @@
+Fix freed memory access in :class:`pyexpat.xmlparser` when building it with an
+installed expat library <= 2.2.0.
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index ec684638ead11..b3d9bdda7e7ac 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1204,10 +1204,10 @@ static void
xmlparse_dealloc(xmlparseobject *self)
{
PyObject_GC_UnTrack(self);
+ (void)xmlparse_clear(self);
if (self->itself != NULL)
XML_ParserFree(self->itself);
self->itself = NULL;
- (void)xmlparse_clear(self);
if (self->handlers != NULL) {
PyMem_Free(self->handlers);
More information about the Python-checkins
mailing list