summaryrefslogtreecommitdiff
path: root/xmlIO.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-08-31 12:15:36 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-08-31 12:15:36 +0000
commit71b956387b083c04fb8e3f0c1b793d4623f86382 (patch)
tree795d238faa01c7c8104fa3378bf98a93048c98e2 /xmlIO.c
parent0bff36ddf7ce32c9d742d54498d4a126e13dbee4 (diff)
downloadlibxml2-71b956387b083c04fb8e3f0c1b793d4623f86382.tar.gz
fixing #151456, an encoding error could generate a serialization loop.
* xmlIO.c: fixing #151456, an encoding error could generate a serialization loop. Daniel
Diffstat (limited to 'xmlIO.c')
-rw-r--r--xmlIO.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmlIO.c b/xmlIO.c
index a80c5837..13a57e7e 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -3024,6 +3024,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
int nbchars = 0; /* number of chars to output to I/O */
int ret; /* return from function call */
int written = 0; /* number of char written to I/O so far */
+ int oldwritten=0;/* loop guard */
int chunk; /* number of byte currently processed from str */
int len; /* number of bytes in str */
int cons; /* byte from str consumed */
@@ -3035,6 +3036,8 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
if (escaping == NULL) escaping = xmlEscapeContent;
do {
+ oldwritten = written;
+
/*
* how many bytes to consume and how many bytes to store.
*/
@@ -3111,7 +3114,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
xmlBufferResize(out->buffer, out->buffer->size + MINLEN);
}
written += nbchars;
- } while (len > 0);
+ } while ((len > 0) && (oldwritten != written));
done:
#ifdef DEBUG_INPUT