]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45329: Fix freed memory access in pyexpat.c (GH-28649)
authorTAGAMI Yukihiro <tagami.yukihiro@gmail.com>
Sat, 2 Oct 2021 09:57:13 +0000 (18:57 +0900)
committerGitHub <noreply@github.com>
Sat, 2 Oct 2021 09:57:13 +0000 (12:57 +0300)
Misc/NEWS.d/next/Library/2021-10-01-13-09-53.bpo-45329.9iMYaO.rst [new file with mode: 0644]
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 (file)
index 0000000..b4bedbc
--- /dev/null
@@ -0,0 +1,2 @@
+Fix freed memory access in :class:`pyexpat.xmlparser` when building it with an
+installed expat library <= 2.2.0.
index ec684638ead1182e6839fd9980d9474ca8623aae..b3d9bdda7e7ac5bafad38ef5f1ba11b60b0874bb 100644 (file)
@@ -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);