mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
For Havoc: - HTMLparser.c parser.c: set ctxt->errNo before calling the
For Havoc: - HTMLparser.c parser.c: set ctxt->errNo before calling the error handlers Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Sat Sep 16 20:12:41 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* HTMLparser.c parser.c: set ctxt->errNo before calling the
|
||||||
|
error or warning handlers
|
||||||
|
|
||||||
Wed Sep 13 22:03:18 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
Wed Sep 13 22:03:18 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* parserInternals.c parserInternals.h parser.c Makefile.am:
|
* parserInternals.c parserInternals.h parser.c Makefile.am:
|
||||||
|
15
HTMLparser.c
15
HTMLparser.c
@ -254,11 +254,11 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
|
|||||||
val |= cur[1] & 0x3f;
|
val |= cur[1] & 0x3f;
|
||||||
}
|
}
|
||||||
if (!IS_CHAR(val)) {
|
if (!IS_CHAR(val)) {
|
||||||
|
ctxt->errNo = XML_ERR_INVALID_ENCODING;
|
||||||
if ((ctxt->sax != NULL) &&
|
if ((ctxt->sax != NULL) &&
|
||||||
(ctxt->sax->error != NULL))
|
(ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"Char 0x%X out of allowed range\n", val);
|
"Char 0x%X out of allowed range\n", val);
|
||||||
ctxt->errNo = XML_ERR_INVALID_ENCODING;
|
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->disableSAX = 1;
|
ctxt->disableSAX = 1;
|
||||||
}
|
}
|
||||||
@ -293,6 +293,7 @@ encoding_error:
|
|||||||
* to ISO-Latin-1 (if you don't like this policy, just declare the
|
* to ISO-Latin-1 (if you don't like this policy, just declare the
|
||||||
* encoding !)
|
* encoding !)
|
||||||
*/
|
*/
|
||||||
|
ctxt->errNo = XML_ERR_INVALID_ENCODING;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"Input is not proper UTF-8, indicate encoding !\n");
|
"Input is not proper UTF-8, indicate encoding !\n");
|
||||||
@ -300,7 +301,6 @@ encoding_error:
|
|||||||
ctxt->input->cur[0], ctxt->input->cur[1],
|
ctxt->input->cur[0], ctxt->input->cur[1],
|
||||||
ctxt->input->cur[2], ctxt->input->cur[3]);
|
ctxt->input->cur[2], ctxt->input->cur[3]);
|
||||||
}
|
}
|
||||||
ctxt->errNo = XML_ERR_INVALID_ENCODING;
|
|
||||||
|
|
||||||
ctxt->charset = XML_CHAR_ENCODING_8859_1;
|
ctxt->charset = XML_CHAR_ENCODING_8859_1;
|
||||||
*len = 1;
|
*len = 1;
|
||||||
@ -1494,12 +1494,12 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
|
|||||||
int c,l;
|
int c,l;
|
||||||
|
|
||||||
if (ctxt->depth > 40) {
|
if (ctxt->depth > 40) {
|
||||||
|
ctxt->errNo = XML_ERR_ENTITY_LOOP;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"Detected entity reference loop\n");
|
"Detected entity reference loop\n");
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->disableSAX = 1;
|
ctxt->disableSAX = 1;
|
||||||
ctxt->errNo = XML_ERR_ENTITY_LOOP;
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1601,7 +1601,6 @@ htmlNewInputStream(htmlParserCtxtPtr ctxt) {
|
|||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"malloc: couldn't allocate a new input stream\n");
|
"malloc: couldn't allocate a new input stream\n");
|
||||||
ctxt->errNo = XML_ERR_NO_MEMORY;
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(input, 0, sizeof(htmlParserInput));
|
memset(input, 0, sizeof(htmlParserInput));
|
||||||
@ -2433,10 +2432,10 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
if (!IS_CHAR(cur)) {
|
if (!IS_CHAR(cur)) {
|
||||||
|
ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"Comment not terminated \n<!--%.50s\n", buf);
|
"Comment not terminated \n<!--%.50s\n", buf);
|
||||||
ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED;
|
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
} else {
|
} else {
|
||||||
@ -2726,10 +2725,10 @@ htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
|
|||||||
ctxt->input->buf->buffer,
|
ctxt->input->buf->buffer,
|
||||||
ctxt->input->buf->raw);
|
ctxt->input->buf->raw);
|
||||||
if (nbchars < 0) {
|
if (nbchars < 0) {
|
||||||
|
ctxt->errNo = XML_ERR_INVALID_ENCODING;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"htmlCheckEncoding: encoder error\n");
|
"htmlCheckEncoding: encoder error\n");
|
||||||
ctxt->errNo = XML_ERR_INVALID_ENCODING;
|
|
||||||
}
|
}
|
||||||
ctxt->input->base =
|
ctxt->input->base =
|
||||||
ctxt->input->cur = ctxt->input->buf->buffer->content;
|
ctxt->input->cur = ctxt->input->buf->buffer->content;
|
||||||
@ -3959,11 +3958,11 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
(avail < 4)) {
|
(avail < 4)) {
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
|
ctxt->errNo = XML_ERR_DOCUMENT_END;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"Extra content at the end of the document\n");
|
"Extra content at the end of the document\n");
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->errNo = XML_ERR_DOCUMENT_END;
|
|
||||||
ctxt->instate = XML_PARSER_EOF;
|
ctxt->instate = XML_PARSER_EOF;
|
||||||
#ifdef DEBUG_PUSH
|
#ifdef DEBUG_PUSH
|
||||||
fprintf(stderr, "HPP: entering EOF\n");
|
fprintf(stderr, "HPP: entering EOF\n");
|
||||||
@ -4390,11 +4389,11 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
|
|||||||
if ((ctxt->instate != XML_PARSER_EOF) &&
|
if ((ctxt->instate != XML_PARSER_EOF) &&
|
||||||
(ctxt->instate != XML_PARSER_EPILOG) &&
|
(ctxt->instate != XML_PARSER_EPILOG) &&
|
||||||
(ctxt->instate != XML_PARSER_MISC)) {
|
(ctxt->instate != XML_PARSER_MISC)) {
|
||||||
|
ctxt->errNo = XML_ERR_DOCUMENT_END;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
ctxt->sax->error(ctxt->userData,
|
ctxt->sax->error(ctxt->userData,
|
||||||
"Extra content at the end of the document\n");
|
"Extra content at the end of the document\n");
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->errNo = XML_ERR_DOCUMENT_END;
|
|
||||||
}
|
}
|
||||||
if (ctxt->instate != XML_PARSER_EOF) {
|
if (ctxt->instate != XML_PARSER_EOF) {
|
||||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||||
|
Reference in New Issue
Block a user