1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

fixed bug #381877, avoid reading over the end of stream when generating an

* HTMLparser.c: fixed bug #381877, avoid reading over the end
  of stream when generating an UTF-8 encoding error.
Daniel

svn path=/trunk/; revision=3627
This commit is contained in:
Daniel Veillard 2007-06-12 08:38:57 +00:00
parent 2e6208651d
commit 861101d1fa
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 12 10:37:42 CEST 2007 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: fixed bug #381877, avoid reading over the end
of stream when generating an UTF-8 encoding error.
Tue Jun 12 10:16:48 CEST 2007 Daniel Veillard <daniel@veillard.com>
* parser.c: fixed bug #366161, trivially added the check in

View File

@ -401,9 +401,13 @@ encoding_error:
{
char buffer[150];
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
ctxt->input->cur[0], ctxt->input->cur[1],
ctxt->input->cur[2], ctxt->input->cur[3]);
if (ctxt->input->end - ctxt->input->cur >= 4) {
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
ctxt->input->cur[0], ctxt->input->cur[1],
ctxt->input->cur[2], ctxt->input->cur[3]);
} else {
snprintf(buffer, 149, "Bytes: 0x%02X\n", ctxt->input->cur[0]);
}
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
"Input is not proper UTF-8, indicate encoding !\n",
BAD_CAST buffer, NULL);