Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libwbxml/, dev-libs/libwbxml/files/
Date: Sat, 26 Feb 2022 19:09:20
Message-Id: 1645902419.8b880213b94234eba5e216a0742e37941d7446cc.sam@gentoo
1 commit: 8b880213b94234eba5e216a0742e37941d7446cc
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 26 19:06:59 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 26 19:06:59 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b880213
7
8 dev-libs/libwbxml: fix compatibility with newer expat
9
10 Bug: https://bugs.gentoo.org/833431
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../files/libwbxml-0.11.7-expat-compat-fixes.patch | 116 +++++++++++++++++++++
14 dev-libs/libwbxml/libwbxml-0.11.7-r1.ebuild | 37 +++++++
15 2 files changed, 153 insertions(+)
16
17 diff --git a/dev-libs/libwbxml/files/libwbxml-0.11.7-expat-compat-fixes.patch b/dev-libs/libwbxml/files/libwbxml-0.11.7-expat-compat-fixes.patch
18 new file mode 100644
19 index 000000000000..00479c7f6437
20 --- /dev/null
21 +++ b/dev-libs/libwbxml/files/libwbxml-0.11.7-expat-compat-fixes.patch
22 @@ -0,0 +1,116 @@
23 +https://github.com/libwbxml/libwbxml/commit/4664d476fb5029073012b91880ce2a9bbc0b4725
24 +https://github.com/libwbxml/libwbxml/commit/4425e80f74b93a590b2c99638b9c5095e6a66244
25 +
26 +From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= <slavek.banko@××××.cz>
27 +Date: Thu, 24 Feb 2022 20:30:18 +0100
28 +Subject: [PATCH] Allow the use of a namespace separator specified by the
29 + constant instead of hardcoded colon in the SyncML related code.
30 +MIME-Version: 1.0
31 +Content-Type: text/plain; charset=UTF-8
32 +Content-Transfer-Encoding: 8bit
33 +
34 +Signed-off-by: Slávek Banko <slavek.banko@××××.cz>
35 +--- a/src/wbxml_internals.h
36 ++++ b/src/wbxml_internals.h
37 +@@ -156,7 +156,9 @@ typedef enum WBXMLWVDataType_e {
38 + #pragma warning(error: 4761) /**< integral size mismatch in argument : conversion supplied */
39 + #endif /* WIN32 */
40 +
41 +-#define WBXML_NAMESPACE_SEPARATOR ':'
42 ++/* Separator must be the same in both cases - once as a char, once as a string */
43 ++#define WBXML_NAMESPACE_SEPARATOR ':'
44 ++#define WBXML_NAMESPACE_SEPARATOR_STR ":"
45 +
46 + /** @} */
47 +
48 +--- a/src/wbxml_tree_clb_xml.c
49 ++++ b/src/wbxml_tree_clb_xml.c
50 +@@ -33,6 +33,7 @@
51 + * @brief WBXML Tree Callbacks for XML Parser (Expat)
52 + */
53 +
54 ++#include "wbxml_internals.h"
55 + #include "wbxml_config_internals.h"
56 +
57 + #if defined( HAVE_EXPAT )
58 +@@ -160,8 +161,8 @@ void wbxml_tree_clb_xml_start_element(void *ctx,
59 + * potentially embedded documents.
60 + */
61 + if ((
62 +- (WBXML_STRCMP(localName, "syncml:devinf:DevInf") == 0) ||
63 +- (WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0)
64 ++ (WBXML_STRCMP(localName, "syncml:devinf" WBXML_NAMESPACE_SEPARATOR_STR "DevInf") == 0) ||
65 ++ (WBXML_STRCMP(localName, "syncml:dmddf1.2" WBXML_NAMESPACE_SEPARATOR_STR "MgmtTree") == 0)
66 + )&&
67 + (tree_ctx->current != NULL))
68 + {
69 +@@ -255,8 +256,8 @@ void wbxml_tree_clb_xml_end_element(void *ctx,
70 + /* End of skipped node */
71 +
72 + #if defined( WBXML_SUPPORT_SYNCML )
73 +- if (WBXML_STRCMP(localName, "syncml:devinf:DevInf") == 0 ||
74 +- WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0) {
75 ++ if (WBXML_STRCMP(localName, "syncml:devinf" WBXML_NAMESPACE_SEPARATOR_STR "DevInf") == 0 ||
76 ++ WBXML_STRCMP(localName, "syncml:dmddf1.2" WBXML_NAMESPACE_SEPARATOR_STR "MgmtTree") == 0) {
77 + /* definitions first ... or some compilers don't like it */
78 + WBXMLBuffer *embed_doc = NULL;
79 + WBXMLTree *tree = NULL;
80 +@@ -277,10 +278,10 @@ void wbxml_tree_clb_xml_end_element(void *ctx,
81 + }
82 +
83 + /* Check Buffer Creation and add the closing tag */
84 +- if ((WBXML_STRCMP(localName, "syncml:devinf:DevInf") == 0 &&
85 ++ if ((WBXML_STRCMP(localName, "syncml:devinf" WBXML_NAMESPACE_SEPARATOR_STR "DevInf") == 0 &&
86 + (!wbxml_buffer_append_cstr(embed_doc, "</DevInf>")))
87 + ||
88 +- (WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0 &&
89 ++ (WBXML_STRCMP(localName, "syncml:dmddf1.2" WBXML_NAMESPACE_SEPARATOR_STR "MgmtTree") == 0 &&
90 + (!wbxml_buffer_append_cstr(embed_doc, "</MgmtTree>"))))
91 + {
92 + tree_ctx->error = WBXML_ERROR_NOT_ENOUGH_MEMORY;
93 +@@ -289,7 +290,7 @@ void wbxml_tree_clb_xml_end_element(void *ctx,
94 + }
95 +
96 + /* Add doctype to give the XML parser a chance */
97 +- if (WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0 &&
98 ++ if (WBXML_STRCMP(localName, "syncml:dmddf1.2" WBXML_NAMESPACE_SEPARATOR_STR "MgmtTree") == 0 &&
99 + tree_ctx->tree->lang->langID != WBXML_LANG_SYNCML_SYNCML12)
100 + {
101 + tree_ctx->error = WBXML_ERROR_UNKNOWN_XML_LANGUAGE;
102 +@@ -305,7 +306,7 @@ void wbxml_tree_clb_xml_end_element(void *ctx,
103 + lang = wbxml_tables_get_table(WBXML_LANG_SYNCML_DEVINF11);
104 + break;
105 + case WBXML_LANG_SYNCML_SYNCML12:
106 +- if (WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0) {
107 ++ if (WBXML_STRCMP(localName, "syncml:dmddf1.2" WBXML_NAMESPACE_SEPARATOR_STR "MgmtTree") == 0) {
108 + lang = wbxml_tables_get_table(WBXML_LANG_SYNCML_DMDDF12);
109 + } else {
110 + lang = wbxml_tables_get_table(WBXML_LANG_SYNCML_DEVINF12);
111 +
112 +From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= <slavek.banko@××××.cz>
113 +Date: Thu, 24 Feb 2022 20:31:15 +0100
114 +Subject: [PATCH] Change the default internal namespace separator from the
115 + colon to the pipe.
116 +MIME-Version: 1.0
117 +Content-Type: text/plain; charset=UTF-8
118 +Content-Transfer-Encoding: 8bit
119 +
120 +This solves compatibility with libexpat >= 2.4.5
121 +after fix the security problem CVE-2022-25236.
122 +
123 +This resolves issue #76.
124 +
125 +Signed-off-by: Slávek Banko <slavek.banko@××××.cz>
126 +--- a/src/wbxml_internals.h
127 ++++ b/src/wbxml_internals.h
128 +@@ -157,8 +157,8 @@ typedef enum WBXMLWVDataType_e {
129 + #endif /* WIN32 */
130 +
131 + /* Separator must be the same in both cases - once as a char, once as a string */
132 +-#define WBXML_NAMESPACE_SEPARATOR ':'
133 +-#define WBXML_NAMESPACE_SEPARATOR_STR ":"
134 ++#define WBXML_NAMESPACE_SEPARATOR '|'
135 ++#define WBXML_NAMESPACE_SEPARATOR_STR "|"
136 +
137 + /** @} */
138 +
139
140 diff --git a/dev-libs/libwbxml/libwbxml-0.11.7-r1.ebuild b/dev-libs/libwbxml/libwbxml-0.11.7-r1.ebuild
141 new file mode 100644
142 index 000000000000..d351e183714d
143 --- /dev/null
144 +++ b/dev-libs/libwbxml/libwbxml-0.11.7-r1.ebuild
145 @@ -0,0 +1,37 @@
146 +# Copyright 1999-2022 Gentoo Authors
147 +# Distributed under the terms of the GNU General Public License v2
148 +
149 +EAPI=7
150 +
151 +inherit cmake
152 +
153 +DESCRIPTION="Library and tools to parse, encode and handle WBXML documents"
154 +HOMEPAGE="https://github.com/libwbxml/libwbxml"
155 +SRC_URI="https://github.com/${PN}/${PN}/archive/${P}.tar.gz"
156 +
157 +LICENSE="GPL-2"
158 +SLOT="0"
159 +KEYWORDS="~amd64 ~ppc ~x86"
160 +IUSE="test"
161 +RESTRICT="!test? ( test )"
162 +
163 +RDEPEND="dev-libs/expat
164 + virtual/libiconv"
165 +DEPEND="${RDEPEND}
166 + test? ( dev-libs/check )"
167 +
168 +DOCS=( BUGS ChangeLog README References THANKS TODO )
169 +S=${WORKDIR}/${PN}-${P}
170 +
171 +PATCHES=(
172 + "${FILESDIR}"/${P}-expat-compat-fixes.patch
173 +)
174 +
175 +src_configure() {
176 + local mycmakeargs=(
177 + -DENABLE_INSTALL_DOC=OFF
178 + -DENABLE_UNIT_TEST=$(usex test)
179 + )
180 +
181 + cmake_src_configure
182 +}