mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
previous fix for #124044 was broken, correct fix provided. fix
* python/libxml.c: previous fix for #124044 was broken, correct fix provided. * HTMLparser.c parser.c parserInternals.c xmlIO.c: fix xmlStopParser() and the error handlers to address #125877 Daniel
This commit is contained in:
34
parser.c
34
parser.c
@@ -141,6 +141,9 @@ static void
|
||||
xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix,
|
||||
const xmlChar * localname)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED;
|
||||
if (prefix == NULL)
|
||||
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
|
||||
@@ -171,6 +174,9 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
|
||||
{
|
||||
const char *errmsg;
|
||||
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
switch (error) {
|
||||
case XML_ERR_INVALID_HEX_CHARREF:
|
||||
errmsg = "CharRef: invalid hexadecimal value\n";
|
||||
@@ -371,6 +377,9 @@ static void
|
||||
xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
|
||||
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg);
|
||||
@@ -395,6 +404,9 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
{
|
||||
xmlStructuredErrorFunc schannel = NULL;
|
||||
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC))
|
||||
schannel = ctxt->sax->serror;
|
||||
@@ -421,6 +433,10 @@ xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1)
|
||||
{
|
||||
xmlStructuredErrorFunc schannel = NULL;
|
||||
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC))
|
||||
schannel = ctxt->sax->serror;
|
||||
@@ -446,6 +462,9 @@ static void
|
||||
xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, int val)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
__xmlRaiseError(NULL, NULL, NULL,
|
||||
ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL,
|
||||
@@ -471,6 +490,9 @@ xmlFatalErrMsgStrIntStr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1, int val,
|
||||
const xmlChar *str2)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
__xmlRaiseError(NULL, NULL, NULL,
|
||||
ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL,
|
||||
@@ -494,6 +516,9 @@ static void
|
||||
xmlFatalErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar * val)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL,
|
||||
XML_FROM_PARSER, error, XML_ERR_FATAL,
|
||||
@@ -517,6 +542,9 @@ static void
|
||||
xmlErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar * val)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL,
|
||||
XML_FROM_PARSER, error, XML_ERR_ERROR,
|
||||
@@ -540,6 +568,9 @@ xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const xmlChar * info1, const xmlChar * info2,
|
||||
const xmlChar * info3)
|
||||
{
|
||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||
(ctxt->instate == XML_PARSER_EOF))
|
||||
return;
|
||||
ctxt->errNo = error;
|
||||
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
|
||||
XML_ERR_ERROR, NULL, 0, (const char *) info1,
|
||||
@@ -10126,7 +10157,10 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
*/
|
||||
void
|
||||
xmlStopParser(xmlParserCtxtPtr ctxt) {
|
||||
if (ctxt == NULL)
|
||||
return;
|
||||
ctxt->instate = XML_PARSER_EOF;
|
||||
ctxt->disableSAX = 1;
|
||||
if (ctxt->input != NULL)
|
||||
ctxt->input->cur = BAD_CAST"";
|
||||
}
|
||||
|
Reference in New Issue
Block a user