]> granicus.if.org Git - libexpat/commitdiff
Fix for bug # 1090885: Problem with Suspend/Resume mechanism.
authorKarl Waclawek <kwaclaw@users.sourceforge.net>
Fri, 24 Dec 2004 16:30:25 +0000 (16:30 +0000)
committerKarl Waclawek <kwaclaw@users.sourceforge.net>
Fri, 24 Dec 2004 16:30:25 +0000 (16:30 +0000)
The code path through XML_Parse() when XML_CONTEXT_BYTES
was not defined, did not take into account that XML_ResumParser()
uses bufferPtr and parseEndPtr as the pointers into the working buffer.

expat/lib/xmlparse.c

index e6badfbd9d44cc67a4a22cbd9da78c4cfeb209ec..163ee27f2b04f9b54af08e9c122989340c477112 100644 (file)
@@ -1441,7 +1441,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
 
     /* If data are left over from last buffer, and we now know that these
        data are the final chunk of input, then we have to check them again
-       to detect errors based on this information.
+       to detect errors based on that fact.
     */
     errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);
 
@@ -1495,7 +1495,6 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
     }
 
     XmlUpdatePosition(encoding, positionPtr, end, &position);
-    positionPtr = end;
     nLeftOver = s + len - end;
     if (nLeftOver) {
       if (buffer == NULL || nLeftOver > bufferLim - buffer) {
@@ -1518,9 +1517,13 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
         bufferLim = buffer + len * 2;
       }
       memcpy(buffer, end, nLeftOver);
-      bufferPtr = buffer;
-      bufferEnd = buffer + nLeftOver;
     }
+    bufferPtr = buffer;
+    bufferEnd = buffer + nLeftOver;
+    positionPtr = bufferPtr;
+    parseEndPtr = bufferEnd;
+    eventPtr = bufferPtr;
+    eventEndPtr = bufferPtr;
     return result;
   }
 #endif  /* not defined XML_CONTEXT_BYTES */