File libxml2-CVE-2023-39615.patch of Package libxml2.34539

From d0c3f01e110d54415611c5fa0040cdf4a56053f9 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sat, 6 May 2023 17:47:37 +0200
Subject: [PATCH] parser: Fix old SAX1 parser with custom callbacks

For some reason, xmlCtxtUseOptionsInternal set the start and end element
SAX handlers to the internal DOM builder functions when XML_PARSE_SAX1
was specified. This means that custom SAX handlers could never work with
that flag because these functions would receive the wrong user data
argument and crash immediately.

Fixes #535.
---
 parser.c | 2 --
 1 file changed, 2 deletions(-)

Index: libxml2-2.10.4/parser.c
===================================================================
--- libxml2-2.10.4.orig/parser.c
+++ libxml2-2.10.4/parser.c
@@ -15064,8 +15064,6 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtP
     }
 #ifdef LIBXML_SAX1_ENABLED
     if (options & XML_PARSE_SAX1) {
-        ctxt->sax->startElement = xmlSAX2StartElement;
-        ctxt->sax->endElement = xmlSAX2EndElement;
         ctxt->sax->startElementNs = NULL;
         ctxt->sax->endElementNs = NULL;
         ctxt->sax->initialized = 1;
openSUSE Build Service is sponsored by