41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
From c3a4816e175ede7da1a692a50d6251efdfe41a45 Mon Sep 17 00:00:00 2001
|
|
From: Snild Dolkow <snild@sony.com>
|
|
Date: Mon, 4 Sep 2023 17:21:14 +0200
|
|
Subject: [PATCH] Don't update partial token heuristic on error
|
|
|
|
Reference: https://github.com/libexpat/libexpat/pull/789/commits/1b9d398517befeb944cbbadadf10992b07e96fa2
|
|
Conflict: no
|
|
|
|
Suggested-by: Sebastian Pipping <sebastian@pipping.org>
|
|
---
|
|
lib/xmlparse.c | 12 +++++++-----
|
|
1 file changed, 7 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
|
|
index 32df1eb9..a8414dd7 100644
|
|
--- a/lib/xmlparse.c
|
|
+++ b/lib/xmlparse.c
|
|
@@ -963,11 +963,13 @@ callProcessor(XML_Parser parser, const char *start, const char *end,
|
|
}
|
|
}
|
|
const enum XML_Error ret = parser->m_processor(parser, start, end, endPtr);
|
|
- // if we consumed nothing, remember what we had on this parse attempt.
|
|
- if (*endPtr == start) {
|
|
- parser->m_partialTokenBytesBefore = have_now;
|
|
- } else {
|
|
- parser->m_partialTokenBytesBefore = 0;
|
|
+ if (ret == XML_ERROR_NONE) {
|
|
+ // if we consumed nothing, remember what we had on this parse attempt.
|
|
+ if (*endPtr == start) {
|
|
+ parser->m_partialTokenBytesBefore = have_now;
|
|
+ } else {
|
|
+ parser->m_partialTokenBytesBefore = 0;
|
|
+ }
|
|
}
|
|
return ret;
|
|
}
|
|
--
|
|
2.33.0
|
|
|
|
|