diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2022-12-21 13:43:40 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2023-01-12 12:02:43 +0000 |
commit | 97a1254923022e66fa75245c3ace64f58112cba6 (patch) | |
tree | 9197c3b414e24ca77d34abc1b7794776dc9df742 /chromium/third_party/libxml/src/xmlsave.c | |
parent | 28a1b2eb95e06bc4dd8c93bb61106e35eaf715c7 (diff) | |
download | qtwebengine-chromium-97a1254923022e66fa75245c3ace64f58112cba6.tar.gz |
[Backport] Security bug 1394382
Manually update libxml to the version 2.9.13 and the sha1
used on 102-based.
Change-Id: I699696b395258a6ba3a1a9b2f48d10036f2b638f
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/450083
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/third_party/libxml/src/xmlsave.c')
-rw-r--r-- | chromium/third_party/libxml/src/xmlsave.c | 69 |
1 files changed, 15 insertions, 54 deletions
diff --git a/chromium/third_party/libxml/src/xmlsave.c b/chromium/third_party/libxml/src/xmlsave.c index 3addd6528d6..77cb7b9b012 100644 --- a/chromium/third_party/libxml/src/xmlsave.c +++ b/chromium/third_party/libxml/src/xmlsave.c @@ -19,56 +19,14 @@ #include <libxml/HTMLtree.h> -#include "buf.h" -#include "enc.h" -#include "save.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/save.h" -/************************************************************************ - * * - * XHTML detection * - * * - ************************************************************************/ -#define XHTML_STRICT_PUBLIC_ID BAD_CAST \ - "-//W3C//DTD XHTML 1.0 Strict//EN" -#define XHTML_STRICT_SYSTEM_ID BAD_CAST \ - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" -#define XHTML_FRAME_PUBLIC_ID BAD_CAST \ - "-//W3C//DTD XHTML 1.0 Frameset//EN" -#define XHTML_FRAME_SYSTEM_ID BAD_CAST \ - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" -#define XHTML_TRANS_PUBLIC_ID BAD_CAST \ - "-//W3C//DTD XHTML 1.0 Transitional//EN" -#define XHTML_TRANS_SYSTEM_ID BAD_CAST \ - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +#ifdef LIBXML_OUTPUT_ENABLED #define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml" -/** - * xmlIsXHTML: - * @systemID: the system identifier - * @publicID: the public identifier - * - * Try to find if the document correspond to an XHTML DTD - * - * Returns 1 if true, 0 if not and -1 in case of error - */ -int -xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) { - if ((systemID == NULL) && (publicID == NULL)) - return(-1); - if (publicID != NULL) { - if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1); - if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1); - if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1); - } - if (systemID != NULL) { - if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1); - if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1); - if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1); - } - return(0); -} - -#ifdef LIBXML_OUTPUT_ENABLED #define TODO \ xmlGenericError(xmlGenericErrorContext, \ @@ -463,7 +421,7 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr) * * This will dump the content of the notation table as an XML DTD definition */ -void +static void xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) { xmlBufferPtr buffer; @@ -474,6 +432,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) { */ return; } + xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT); xmlDumpNotationTable(buffer, table); xmlBufMergeBuffer(buf, buffer); } @@ -486,7 +445,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) { * This will dump the content of the element declaration as an XML * DTD definition */ -void +static void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) { xmlBufferPtr buffer; @@ -497,6 +456,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) { */ return; } + xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT); xmlDumpElementDecl(buffer, elem); xmlBufMergeBuffer(buf, buffer); } @@ -509,7 +469,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) { * This will dump the content of the attribute declaration as an XML * DTD definition */ -void +static void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) { xmlBufferPtr buffer; @@ -520,6 +480,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) { */ return; } + xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT); xmlDumpAttributeDecl(buffer, attr); xmlBufMergeBuffer(buf, buffer); } @@ -531,7 +492,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) { * * This will dump the content of the entity table as an XML DTD definition */ -void +static void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) { xmlBufferPtr buffer; @@ -542,6 +503,7 @@ xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) { */ return; } + xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT); xmlDumpEntityDecl(buffer, ent); xmlBufMergeBuffer(buf, buffer); } @@ -591,7 +553,6 @@ static void xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); #endif static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); -void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); /** @@ -1375,7 +1336,7 @@ xhtmlAttrListDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) { (htmlIsBooleanAttr(cur->name))) { if (cur->children != NULL) xmlFreeNode(cur->children); - cur->children = xmlNewText(cur->name); + cur->children = xmlNewDocText(cur->doc, cur->name); if (cur->children != NULL) cur->children->parent = (xmlNodePtr) cur; } @@ -2174,7 +2135,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, xmlBufBackToBuffer(buffer); if (ret > INT_MAX) return(-1); - return((int) ret); + return(ret); } /** |