summaryrefslogtreecommitdiff
path: root/HTMLparser.c
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2007-06-13 20:47:19 +0200
committerMike Hommey <glandium@debian.org>2007-06-13 20:47:19 +0200
commit58f9d16e3a77d5207d9ccc413b61e2cb45190018 (patch)
treef190471ceb2bc35c076cc65159141813da73c8ee /HTMLparser.c
parent789259a1b6850d30acffbb62b11456b9ed7a8f59 (diff)
downloadlibxml2-58f9d16e3a77d5207d9ccc413b61e2cb45190018.tar.gz
Load /tmp/libxml2-2.6.29 intoupstream/2.6.29.dfsg
libxml2/branches/upstream/current.
Diffstat (limited to 'HTMLparser.c')
-rw-r--r--HTMLparser.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/HTMLparser.c b/HTMLparser.c
index 8f2f776..91d54c7 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -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);
@@ -472,8 +476,8 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
#define NB_FONTSTYLE 8
#define PHRASE "em", "strong", "dfn", "code", "samp", "kbd", "var", "cite", "abbr", "acronym"
#define NB_PHRASE 10
-#define SPECIAL "a", "img", "applet", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe"
-#define NB_SPECIAL 15
+#define SPECIAL "a", "img", "applet", "embed", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe"
+#define NB_SPECIAL 16
#define INLINE PCDATA FONTSTYLE PHRASE SPECIAL FORMCTRL
#define NB_INLINE NB_PCDATA + NB_FONTSTYLE + NB_PHRASE + NB_SPECIAL + NB_FORMCTRL
#define BLOCK HEADING, LIST "pre", "p", "dl", "div", "center", "noscript", "noframes", "blockquote", "form", "isindex", "hr", "table", "fieldset", "address"
@@ -572,6 +576,7 @@ static const char* const version_attr[] = { "version", NULL } ;
static const char* const html_content[] = { "head", "body", "frameset", NULL } ;
static const char* const iframe_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width", NULL } ;
static const char* const img_attrs[] = { ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap", NULL } ;
+static const char* const embed_attrs[] = { COREATTRS, "align", "alt", "border", "code", "codebase", "frameborder", "height", "hidden", "hspace", "name", "palette", "pluginspace", "pluginurl", "src", "type", "units", "vspace", "width", NULL } ;
static const char* const input_attrs[] = { ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept", NULL } ;
static const char* const prompt_attrs[] = { COREATTRS, I18N, "prompt", NULL } ;
static const char* const label_attrs[] = { ATTRS, "for", "accesskey", "onfocus", "onblur", NULL } ;
@@ -706,6 +711,9 @@ html40ElementTable[] = {
{ "em", 0, 3, 0, 0, 0, 0, 1, "emphasis",
DECL html_inline, NULL, DECL html_attrs, NULL, NULL
},
+{ "embed", 0, 1, 2, 0, 1, 1, 1, "generic embedded object ",
+ EMPTY, NULL, DECL embed_attrs, NULL, NULL
+},
{ "fieldset", 0, 0, 0, 0, 0, 0, 0, "form control group ",
DECL fieldset_contents , NULL, DECL html_attrs, NULL, NULL
},
@@ -4391,8 +4399,7 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) {
* Returns the new parser context or NULL
*/
static htmlParserCtxtPtr
-htmlCreateDocParserCtxt(const xmlChar *cur,
- const char *encoding ATTRIBUTE_UNUSED) {
+htmlCreateDocParserCtxt(const xmlChar *cur, const char *encoding) {
int len;
htmlParserCtxtPtr ctxt;
@@ -4400,6 +4407,8 @@ htmlCreateDocParserCtxt(const xmlChar *cur,
return(NULL);
len = xmlStrlen(cur);
ctxt = htmlCreateMemoryParserCtxt((char *)cur, len);
+ if (ctxt == NULL)
+ return(NULL);
if (encoding != NULL) {
xmlCharEncoding enc;