[libxml2] Fix random dropping of characters on dumping ASCII encoded XML
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix random dropping of characters on dumping ASCII encoded XML
- Date: Sun, 16 Jan 2022 15:02:04 +0000 (UTC)
commit eb4c1bf85545db74b4f8fa42ffb09c92b847b271
Author: Mohammad Razavi <mrazavi64 gmail com>
Date: Wed Nov 3 09:48:13 2021 +0330
Fix random dropping of characters on dumping ASCII encoded XML
Fix a bug in xmlCharEncOutput return value which will cause
xmlNodeDumpOutput to drop characters randomly.
xmlCharEncOutput returns zero if the length of the input buffer is
zero but ignores the fact that it may already encoded the input buffer
and the input's length is zero due to the fact that xmlEncOutputChunk
returned -2 errors and underlying code tries to fix the error by
encoding the input.
xmlCharEncOutput is collecting the number of bytes written to the
output buffer but is returning zero instead of the total number of
bytes in this situation. This commit will fix this issue by returning
the total number of bytes instead. So the xmlNodeDumpOutput will also
continue writing and will not stop due to the fact that it mistakenly
thinks the output buffer is not changed in that iteration.
Fixes #314
encoding.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/encoding.c b/encoding.c
index 5d28e4f1..5e7b03af 100644
--- a/encoding.c
+++ b/encoding.c
@@ -2496,7 +2496,7 @@ retry:
*/
toconv = xmlBufUse(in);
if (toconv == 0)
- return (0);
+ return (writtentot);
if (toconv > 64 * 1024)
toconv = 64 * 1024;
if (toconv * 4 >= written) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]