1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00
Files
UXP/parser/expat/11_nested_entities.patch.skip
T
Job Bautista a730f838c8 Issue #2889 - Part 5: Rewrite patches for Expat 2.7.3.
- Skipped the fix for BZ 569229 because I don't know where to apply that; the
  processInternalEntity method no longer exists. Hopefully the bug doesn't re-
  appear.
- Previous fixes for 3rd and 13th patches have been merged to their respective
  patches as well.
- 15th patch is now a fix for the 13th and 14th since somewhere between 2.6.4
  and 2.7.3 has made use of a debugging method we don't want to use as well as
  a new boolean method called parserBusy which got mistakenly excluded as an
  unused API while rewriting the 14th patch.
2026-01-14 00:03:54 +08:00

34 lines
1.4 KiB
Plaintext

diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -6085,7 +6085,29 @@ processInternalEntity(XML_Parser parser,
entityTrackingOnClose(parser, entity, __LINE__);
#endif /* XML_GE == 1 */
entity->open = XML_FALSE;
+/* BEGIN MOZILLA CHANGE (Bug 569229 - Deal with parser interruption from nested entities) */
+#if 0
parser->m_openInternalEntities = openEntity->next;
+#else
+ if (parser->m_openInternalEntities == openEntity) {
+ parser->m_openInternalEntities = openEntity->next;
+ }
+ else {
+ /* openEntity should be closed, but it contains an inner entity that is
+ still open. Remove openEntity from the m_openInternalEntities linked
+ list by looking for the inner entity in the list that links to
+ openEntity and fixing up its 'next' member
+ */
+ OPEN_INTERNAL_ENTITY *innerOpenEntity = parser->m_openInternalEntities;
+ do {
+ if (innerOpenEntity->next == openEntity) {
+ innerOpenEntity->next = openEntity->next;
+ break;
+ }
+ } while ((innerOpenEntity = innerOpenEntity->next));
+ }
+#endif
+/* END MOZILLA CHANGE */
/* put openEntity back in list of free instances */
openEntity->next = parser->m_freeInternalEntities;
parser->m_freeInternalEntities = openEntity;