[XML-SIG] Preparing for 0.6.4

Dieter Maurer dieter@handshake.de
Tue, 20 Feb 2001 20:03:12 +0100 (CET)


--Multipart_Tue_Feb_20_20:03:12_2001-1
Content-Type: text/plain; charset=US-ASCII

Martin v. Loewis writes:
 > I'm going to release PyXML 0.6.4 later this week or early next
 > week. If you have any pending changes that you want to integrate,
 > please let me know, or commit them yourself.
I hit a strange bug in "expat.c" (still 0.6.2) last Sunday:

  "expat" reported "no element found".

  The problem only occured during parsing of an external entity.

  It was caused by a buffer switch inside a CDATA section
  (in the external entity).
  When "expat.c" left the CDATA, it chose "contentProcessor"
  as "processor" rather than "externalEntityContentProcessor".
  When it reached the end of the external entity,
  "contentProcessor" found an inconsitent state and threw the
  "no element found" exception.

I have a patch appended. I am not sure, whether it is still
necessary for 0.6.3.


Dieter

----------------------------------------------------------------------

--Multipart_Tue_Feb_20_20:03:12_2001-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="xmlparse.pat"
Content-Transfer-Encoding: 7bit

--- :xmlparse.c	Fri Sep 24 04:18:38 1999
+++ xmlparse.c	Sat Feb 17 22:47:31 2001
@@ -301,6 +301,7 @@
   void (*m_unknownEncodingRelease)(void *);
   PROLOG_STATE m_prologState;
   Processor *m_processor;
+  Processor *m_beforeCdataProcessor;
   enum XML_Error m_errorCode;
   const char *m_eventPtr;
   const char *m_eventEndPtr;
@@ -360,6 +361,7 @@
 #define ns (((Parser *)parser)->m_ns)
 #define prologState (((Parser *)parser)->m_prologState)
 #define processor (((Parser *)parser)->m_processor)
+#define beforeCdataProcessor (((Parser *)parser)->m_beforeCdataProcessor)
 #define errorCode (((Parser *)parser)->m_errorCode)
 #define eventPtr (((Parser *)parser)->m_eventPtr)
 #define eventEndPtr (((Parser *)parser)->m_eventEndPtr)
@@ -1384,6 +1386,9 @@
     case XML_TOK_CDATA_SECT_OPEN:
       {
 	enum XML_Error result;
+
+	beforeCdataProcessor= processor;
+
 	if (startCdataSectionHandler)
   	  startCdataSectionHandler(handlerArg);
 #if 0
@@ -1731,8 +1736,8 @@
 {
   enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr);
   if (start) {
-    processor = contentProcessor;
-    return contentProcessor(parser, start, end, endPtr);
+    /* processor = contentProcessor; */
+    return processor(parser, start, end, endPtr);
   }
   return result;
 }
@@ -1767,6 +1772,9 @@
     *eventEndPP = next;
     switch (tok) {
     case XML_TOK_CDATA_SECT_CLOSE:
+
+      processor= beforeCdataProcessor;
+
       if (endCdataSectionHandler)
 	endCdataSectionHandler(handlerArg);
 #if 0



--Multipart_Tue_Feb_20_20:03:12_2001-1--