File CVE-2024-50602-no-crash-XML_ResumeParser.patch of Package python-wxPython

---
 ext/wxWidgets/src/expat/expat/lib/expat.h    |    4 +++-
 ext/wxWidgets/src/expat/expat/lib/xmlparse.c |   11 ++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

--- a/ext/wxWidgets/src/expat/expat/lib/expat.h
+++ b/ext/wxWidgets/src/expat/expat/lib/expat.h
@@ -127,7 +127,9 @@ enum XML_Error {
   /* Added in 2.3.0. */
   XML_ERROR_NO_BUFFER,
   /* Added in 2.4.0. */
-  XML_ERROR_AMPLIFICATION_LIMIT_BREACH
+  XML_ERROR_AMPLIFICATION_LIMIT_BREACH,
+  /* Added in 2.6.4. */
+  XML_ERROR_NOT_STARTED,
 };
 
 enum XML_Content_Type {
--- a/ext/wxWidgets/src/expat/expat/lib/xmlparse.c
+++ b/ext/wxWidgets/src/expat/expat/lib/xmlparse.c
@@ -2207,6 +2207,9 @@ XML_StopParser(XML_Parser parser, XML_Bo
   if (parser == NULL)
     return XML_STATUS_ERROR;
   switch (parser->m_parsingStatus.parsing) {
+  case XML_INITIALIZED:
+    parser->m_errorCode = XML_ERROR_NOT_STARTED;
+    return XML_STATUS_ERROR;
   case XML_SUSPENDED:
     if (resumable) {
       parser->m_errorCode = XML_ERROR_SUSPENDED;
@@ -2217,7 +2220,7 @@ XML_StopParser(XML_Parser parser, XML_Bo
   case XML_FINISHED:
     parser->m_errorCode = XML_ERROR_FINISHED;
     return XML_STATUS_ERROR;
-  default:
+  case XML_PARSING:
     if (resumable) {
 #ifdef XML_DTD
       if (parser->m_isParamEntity) {
@@ -2228,6 +2231,9 @@ XML_StopParser(XML_Parser parser, XML_Bo
       parser->m_parsingStatus.parsing = XML_SUSPENDED;
     } else
       parser->m_parsingStatus.parsing = XML_FINISHED;
+    break;
+  default:
+    assert(0);
   }
   return XML_STATUS_OK;
 }
@@ -2493,6 +2499,9 @@ XML_ErrorString(enum XML_Error code) {
     return XML_L(
         "limit on input amplification factor (from DTD and entities) breached");
   }
+  /* Added in 2.6.4. */
+  case XML_ERROR_NOT_STARTED:
+    return XML_L("parser not started");
   return NULL;
 }
 
openSUSE Build Service is sponsored by