1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

parser: Rewrite push parser boundary checks

Remove inaccurate xmlParseCheckTransition check.

Remove non-incremental xmlParseGetLasts check.

Add functions that check for several boundary constructs more
accurately, keeping track of progress in ctxt->checkIndex.

Fixes #439.
This commit is contained in:
Nick Wellnhofer
2022-11-15 18:23:33 +01:00
parent 2059df5358
commit 68a6518c45
7 changed files with 362 additions and 475 deletions

5
SAX2.c
View File

@@ -387,6 +387,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
xmlCharEncoding enc;
int oldcharset;
const xmlChar *oldencoding;
int oldprogressive;
/*
* Ask the Entity resolver to load the damn thing
@@ -409,7 +410,9 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
oldinputTab = ctxt->inputTab;
oldcharset = ctxt->charset;
oldencoding = ctxt->encoding;
oldprogressive = ctxt->progressive;
ctxt->encoding = NULL;
ctxt->progressive = 0;
ctxt->inputTab = (xmlParserInputPtr *)
xmlMalloc(5 * sizeof(xmlParserInputPtr));
@@ -422,6 +425,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
ctxt->inputTab = oldinputTab;
ctxt->charset = oldcharset;
ctxt->encoding = oldencoding;
ctxt->progressive = oldprogressive;
return;
}
ctxt->inputNr = 0;
@@ -472,6 +476,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
(!xmlDictOwns(ctxt->dict, ctxt->encoding))))
xmlFree((xmlChar *) ctxt->encoding);
ctxt->encoding = oldencoding;
ctxt->progressive = oldprogressive;
/* ctxt->wellFormed = oldwellFormed; */
}
}