textproc/libxml2: fix build with VALIDATION option off

Grab two commits from upstream that fix the build when
--no-valid is passed to configure; in the ports build
that translates to the VALIDATION option turned off.
These come straight from GNOME GitLab, although I've
bunged them into one patch-* file.

Not bumping PORTREVISION, since with this option off
it would never have built, and with the option on
the resulting package is unchanged.

PR:		253596
This commit is contained in:
Adriaan de Groot 2021-05-05 02:11:31 +02:00
parent 4e07c747f6
commit cd8e694917
2 changed files with 39 additions and 7 deletions

View file

@ -7,13 +7,6 @@ CATEGORIES?= textproc gnome
MASTER_SITES= http://xmlsoft.org/sources/
DIST_SUBDIR= gnome2
# CVE-2019-20388, CVE-2020-7595, CVE-2020-24977, Python 3.9 support
#PATCH_SITES= https://gitlab.gnome.org/GNOME/libxml2/commit/
#PATCHFILES= 7ffcd44d7e6c46704f8af0321d9314cd26e0e18a.patch:-p1 \
# 0e1a49c8907645d2e155f0d89d4d9895ac5112b5.patch:-p1 \
# 50f06b3efb638efb0abd95dc62dca05ae67882c2.patch:-p1 \
# edc7b6abb0c125eeb888748c334897f60aab0854.patch:-p1
MAINTAINER?= desktop@FreeBSD.org
COMMENT?= XML parser library for GNOME

View file

@ -0,0 +1,39 @@
commit 106757e8c1e26ad9b8c924c7f304074b79e082c5
Author: Daniel Cheng <dcheng@google.com>
Date: Fri Apr 10 14:52:03 2020 -0700
Guard new calls to xmlValidatePopElement in xml_reader.c
Closes #154.
commit 386fb27654b93d9fb2880e03fb508d618a2e66f1
Author: Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
Date: Tue Apr 28 17:00:37 2020 +0200
Add LIBXML_VALID_ENABLED to xmlreader
There are already LIBXML_VALID_ENABLED in this file to guard against
"--without-valid" at "./configure" step, but here they were missing.
diff --git xmlreader.c xmlreader.c
index 687c8b3c..3fd9aa4c 100644
--- xmlreader.c
+++ xmlreader.c
@@ -2260,14 +2260,18 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
if (reader->ctxt != NULL) {
if (reader->dict == reader->ctxt->dict)
reader->dict = NULL;
+#ifdef LIBXML_VALID_ENABLED
if ((reader->ctxt->vctxt.vstateTab != NULL) &&
(reader->ctxt->vctxt.vstateMax > 0)){
+#ifdef LIBXML_REGEXP_ENABLED
while (reader->ctxt->vctxt.vstateNr > 0)
xmlValidatePopElement(&reader->ctxt->vctxt, NULL, NULL, NULL);
+#endif /* LIBXML_REGEXP_ENABLED */
xmlFree(reader->ctxt->vctxt.vstateTab);
reader->ctxt->vctxt.vstateTab = NULL;
reader->ctxt->vctxt.vstateMax = 0;
}
+#endif /* LIBXML_VALID_ENABLED */
if (reader->ctxt->myDoc != NULL) {
if (reader->preserve == 0)
xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);