[xml] null pointer access in htmlCreateDocParserCtxt()
- From: Jean-Daniel Dupas <jddupas yahoo fr>
- To: xml gnome org
- Subject: [xml] null pointer access in htmlCreateDocParserCtxt()
- Date: Thu, 26 Apr 2007 10:29:16 +0200
Hello,
I just want to signal a problem in htmlCreateDocParserCtxt.
If "htmlCreateMemoryParserCtxt" returns a NULL context and the
encoding parameter is not null, htmlCreateDocParserCtxt wil crash
when it try to read "ctxt->input->encoding".
This append for example when the cur parameter is an empty string.
And about the htmlCreateDocParserCtxt function declaratin, is the
flag ATTRIBUTE_UNUSED relevant ?
static htmlParserCtxtPtr
htmlCreateDocParserCtxt(const xmlChar *cur,
const char *encoding ATTRIBUTE_UNUSED) {
int len;
htmlParserCtxtPtr ctxt;
if (cur == NULL)
return(NULL);
len = xmlStrlen(cur);
ctxt = htmlCreateMemoryParserCtxt((char *)cur, len);
if (encoding != NULL) {
xmlCharEncoding enc;
xmlCharEncodingHandlerPtr handler;
if (ctxt->input->encoding != NULL)
xmlFree((xmlChar *) ctxt->input->encoding);
ctxt->input->encoding = xmlStrdup((const xmlChar *) encoding);
Jean-Daniel Dupas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]