已开启
fix: parser: Fix parsing of DTD content #446
zhangtao99创建于 9月15日
fix: parser: Fix parsing of DTD content #446
已开启
共 2 个文件变更+195-1
| @@ -0,0 +1,187 @@ | |||
| 1 | +Origin: https://gitlab.gnome.org/GNOME/libxml2/-/commit/0740a367a570c40246fe8077c2d172b63693f105 | ||
| 2 | +From 2fb3818e09309d4083c77e07a0a1e2cc68fca6fe Mon Sep 17 00:00:00 2001 | ||
| 3 | +From: Nick Wellnhofer <wellnhofer@aevum.de> | ||
| 4 | +Date: Sat, 1 Mar 2025 10:25:29 +0100 | ||
| 5 | +Subject: [PATCH] parser: Fix parsing of DTD content | ||
| 6 | + | ||
| 7 | +Regressed in 2.11. Fixes #868. | ||
| 8 | +--- | ||
| 9 | + parser.c | 6 +++++- | ||
| 10 | + result/errors/759573-2.xml.ent | 6 ++++++ | ||
| 11 | + result/errors/759573-2.xml.err | 6 ++++++ | ||
| 12 | + result/errors/759573-2.xml.str | 6 ++++++ | ||
| 13 | + result/errors/759573.xml.ent | 6 ++++++ | ||
| 14 | + result/errors/759573.xml.err | 6 ++++++ | ||
| 15 | + result/errors/759573.xml.str | 6 ++++++ | ||
| 16 | + result/errors/issue868.xml.ent | 3 +++ | ||
| 17 | + result/errors/issue868.xml.err | 3 +++ | ||
| 18 | + result/errors/issue868.xml.str | 4 ++++ | ||
| 19 | + test/errors/issue868.xml | 9 +++++++++ | ||
| 20 | + 11 files changed, 60 insertions(+), 1 deletion(-) | ||
| 21 | + create mode 100644 result/errors/issue868.xml.ent | ||
| 22 | + create mode 100644 result/errors/issue868.xml.err | ||
| 23 | + create mode 100644 result/errors/issue868.xml.str | ||
| 24 | + create mode 100644 test/errors/issue868.xml | ||
| 25 | + | ||
| 26 | +diff --git a/parser.c b/parser.c | ||
| 27 | +index 8fe0a06..474644c 100644 | ||
| 28 | +--- a/parser.c | ||
| 29 | ++++ b/parser.c | ||
| 30 | +@@ -6868,7 +6868,11 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) { | ||
| 31 | + xmlParseComment(ctxt); | ||
| 32 | + break; | ||
| 33 | + default: | ||
| 34 | +- /* there is an error but it will be detected later */ | ||
| 35 | ++ xmlFatalErr(ctxt, | ||
| 36 | ++ ctxt->inSubset == 2 ? | ||
| 37 | ++ XML_ERR_EXT_SUBSET_NOT_FINISHED : | ||
| 38 | ++ XML_ERR_DOCTYPE_NOT_FINISHED, | ||
| 39 | ++ NULL); | ||
| 40 | + SKIP(2); | ||
| 41 | + break; | ||
| 42 | + } | ||
| 43 | +diff --git a/result/errors/759573-2.xml.ent b/result/errors/759573-2.xml.ent | ||
| 44 | +index 01c8157..5f0d4a2 100644 | ||
| 45 | +--- a/result/errors/759573-2.xml.ent | ||
| 46 | ++++ b/result/errors/759573-2.xml.ent | ||
| 47 | +@@ -16,6 +16,12 @@ Entity: line 1: parser error : ParsePI: PI xDOCTYPEm space expected | ||
| 48 | + Entity: line 1: | ||
| 49 | + <!ENTITY<?xDOCTYPEm~?> | ||
| 50 | + ^ | ||
| 51 | ++./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated | ||
| 52 | ++%xx; | ||
| 53 | ++ ^ | ||
| 54 | ++Entity: line 2: | ||
| 55 | ++<![INCLUDE[ | ||
| 56 | ++^ | ||
| 57 | + ./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration | ||
| 58 | + | ||
| 59 | + %xx; | ||
| 60 | +diff --git a/result/errors/759573-2.xml.err b/result/errors/759573-2.xml.err | ||
| 61 | +index 01c8157..5f0d4a2 100644 | ||
| 62 | +--- a/result/errors/759573-2.xml.err | ||
| 63 | ++++ b/result/errors/759573-2.xml.err | ||
| 64 | +@@ -16,6 +16,12 @@ Entity: line 1: parser error : ParsePI: PI xDOCTYPEm space expected | ||
| 65 | + Entity: line 1: | ||
| 66 | + <!ENTITY<?xDOCTYPEm~?> | ||
| 67 | + ^ | ||
| 68 | ++./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated | ||
| 69 | ++%xx; | ||
| 70 | ++ ^ | ||
| 71 | ++Entity: line 2: | ||
| 72 | ++<![INCLUDE[ | ||
| 73 | ++^ | ||
| 74 | + ./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration | ||
| 75 | + | ||
| 76 | + %xx; | ||
| 77 | +diff --git a/result/errors/759573-2.xml.str b/result/errors/759573-2.xml.str | ||
| 78 | +index 39f77a6..6cf8179 100644 | ||
| 79 | +--- a/result/errors/759573-2.xml.str | ||
| 80 | ++++ b/result/errors/759573-2.xml.str | ||
| 81 | +@@ -16,6 +16,12 @@ Entity: line 1: parser error : ParsePI: PI xDOCTYPEm space expected | ||
| 82 | + Entity: line 1: | ||
| 83 | + <!ENTITY<?xDOCTYPEm~?> | ||
| 84 | + ^ | ||
| 85 | ++./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated | ||
| 86 | ++%xx; | ||
| 87 | ++ ^ | ||
| 88 | ++Entity: line 2: | ||
| 89 | ++<![INCLUDE[ | ||
| 90 | ++^ | ||
| 91 | + ./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration | ||
| 92 | + | ||
| 93 | + %xx; | ||
| 94 | +diff --git a/result/errors/759573.xml.ent b/result/errors/759573.xml.ent | ||
| 95 | +index 74322b6..1b81106 100644 | ||
| 96 | +--- a/result/errors/759573.xml.ent | ||
| 97 | ++++ b/result/errors/759573.xml.ent | ||
| 98 | +@@ -11,6 +11,12 @@ LEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz | ||
| 99 | + T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx; | ||
| 100 | + ^ | ||
| 101 | + Entity: line 1: | ||
| 102 | ++%<![INCLUDE[000%ஸ000%z; | ||
| 103 | ++ ^ | ||
| 104 | ++./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated | ||
| 105 | ++T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx; | ||
| 106 | ++ ^ | ||
| 107 | ++Entity: line 1: | ||
| 108 | + %<![INCLUDE[000%ஸ000%z; | ||
| 109 | + ^ | ||
| 110 | + ./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration | ||
| 111 | +diff --git a/result/errors/759573.xml.err b/result/errors/759573.xml.err | ||
| 112 | +index 74322b6..1b81106 100644 | ||
| 113 | +--- a/result/errors/759573.xml.err | ||
| 114 | ++++ b/result/errors/759573.xml.err | ||
| 115 | +@@ -11,6 +11,12 @@ LEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz | ||
| 116 | + T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx; | ||
| 117 | + ^ | ||
| 118 | + Entity: line 1: | ||
| 119 | ++%<![INCLUDE[000%ஸ000%z; | ||
| 120 | ++ ^ | ||
| 121 | ++./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated | ||
| 122 | ++T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx; | ||
| 123 | ++ ^ | ||
| 124 | ++Entity: line 1: | ||
| 125 | + %<![INCLUDE[000%ஸ000%z; | ||
| 126 | + ^ | ||
| 127 | + ./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration | ||
| 128 | +diff --git a/result/errors/759573.xml.str b/result/errors/759573.xml.str | ||
| 129 | +index 37df762..b4962e9 100644 | ||
| 130 | +--- a/result/errors/759573.xml.str | ||
| 131 | ++++ b/result/errors/759573.xml.str | ||
| 132 | +@@ -11,6 +11,12 @@ LEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz | ||
| 133 | + T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx; | ||
| 134 | + ^ | ||
| 135 | + Entity: line 1: | ||
| 136 | ++%<![INCLUDE[000%ஸ000%z; | ||
| 137 | ++ ^ | ||
| 138 | ++./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated | ||
| 139 | ++T t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ000%z;'><!ENTITYz>%xx; | ||
| 140 | ++ ^ | ||
| 141 | ++Entity: line 1: | ||
| 142 | + %<![INCLUDE[000%ஸ000%z; | ||
| 143 | + ^ | ||
| 144 | + ./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration | ||
| 145 | +diff --git a/result/errors/issue868.xml.ent b/result/errors/issue868.xml.ent | ||
| 146 | +new file mode 100644 | ||
| 147 | +index 0000000..5b5d580 | ||
| 148 | +--- /dev/null | ||
| 149 | ++++ b/result/errors/issue868.xml.ent | ||
| 150 | +@@ -0,0 +1,3 @@ | ||
| 151 | ++./test/errors/issue868.xml:3: parser error : DOCTYPE improperly terminated | ||
| 152 | ++<!]> | ||
| 153 | ++^ | ||
| 154 | +diff --git a/result/errors/issue868.xml.err b/result/errors/issue868.xml.err | ||
| 155 | +new file mode 100644 | ||
| 156 | +index 0000000..5b5d580 | ||
| 157 | +--- /dev/null | ||
| 158 | ++++ b/result/errors/issue868.xml.err | ||
| 159 | +@@ -0,0 +1,3 @@ | ||
| 160 | ++./test/errors/issue868.xml:3: parser error : DOCTYPE improperly terminated | ||
| 161 | ++<!]> | ||
| 162 | ++^ | ||
| 163 | +diff --git a/result/errors/issue868.xml.str b/result/errors/issue868.xml.str | ||
| 164 | +new file mode 100644 | ||
| 165 | +index 0000000..e886a3b | ||
| 166 | +--- /dev/null | ||
| 167 | ++++ b/result/errors/issue868.xml.str | ||
| 168 | +@@ -0,0 +1,4 @@ | ||
| 169 | ++./test/errors/issue868.xml:3: parser error : DOCTYPE improperly terminated | ||
| 170 | ++<!]> | ||
| 171 | ++^ | ||
| 172 | ++./test/errors/issue868.xml : failed to parse | ||
| 173 | +diff --git a/test/errors/issue868.xml b/test/errors/issue868.xml | ||
| 174 | +new file mode 100644 | ||
| 175 | +index 0000000..e08ad3e | ||
| 176 | +--- /dev/null | ||
| 177 | ++++ b/test/errors/issue868.xml | ||
| 178 | +@@ -0,0 +1,9 @@ | ||
| 179 | ++<?xml version="1.0" encoding="ISO-8859-1"?> | ||
| 180 | ++<!DOCTYPE rss [ | ||
| 181 | ++<!]> | ||
| 182 | ++<rss> | ||
| 183 | ++<channel> | ||
| 184 | ++<image/> | ||
| 185 | ++<title>PP</title> | ||
| 186 | ++</channel> | ||
| 187 | ++</rss> | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | Summary: Library providing XML and HTML support | 1 | Summary: Library providing XML and HTML support |
| 2 | Name: libxml2 | 2 | Name: libxml2 |
| 3 | Version: 2.11.9 | 3 | Version: 2.11.9 |
| 4 | -Release: 18 | 4 | +Release: 19 |
| 5 | License: MIT | 5 | License: MIT |
| 6 | Group: Development/Libraries | 6 | Group: Development/Libraries |
| 7 | Source: https://download.gnome.org/sources/%{name}/2.11/%{name}-%{version}.tar.xz | 7 | Source: https://download.gnome.org/sources/%{name}/2.11/%{name}-%{version}.tar.xz |
| @@ -35,6 +35,7 @@ Patch25: CVE-2026-17705.patch | |||
| 35 | Patch26: backport-CVE-2026-86138.patch | 35 | Patch26: backport-CVE-2026-86138.patch |
| 36 | Patch27: backport-CVE-2026-86140.patch | 36 | Patch27: backport-CVE-2026-86140.patch |
| 37 | Patch28: backport-CVE-2026-86137,CVE-2026-86141.patch | 37 | Patch28: backport-CVE-2026-86137,CVE-2026-86141.patch |
| 38 | +Patch29: backport-Fix-parsing-of-DTD-content.patch | ||
| 38 | 39 | ||
| 39 | BuildRequires: python3-devel | 40 | BuildRequires: python3-devel |
| 40 | BuildRequires: zlib-devel | 41 | BuildRequires: zlib-devel |
| @@ -172,6 +173,12 @@ gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz | |||
| 172 | 173 | ||
| 173 | 174 | ||
| 174 | %changelog | 175 | %changelog |
| 176 | +* Tue Sep 15 2026 zhangtao <zhangtao@kylinos.cn> - 2.11.9-19 | ||
| 177 | +- Type:Bugfix | ||
| 178 | +- ID:NA | ||
| 179 | +- SUG:NA | ||
| 180 | +- DESC:backport upstream fix for DTD content parsing error (issue #868) | ||
| 181 | + | ||
| 175 | * Wed Sep 09 2026 Funda Wang <fundawang@yeah.net> - 2.11.9-18 | 182 | * Wed Sep 09 2026 Funda Wang <fundawang@yeah.net> - 2.11.9-18 |
| 176 | - fix CVE-2026-86137, CVE-2026-86141 | 183 | - fix CVE-2026-86137, CVE-2026-86141 |
| 177 | 184 | ||