- update to xerces-c-3.2.1 by redoing this port from scratch

* catches up to years of negligence for this xml parser which had accumulated
  a number of outstanding security issues
This commit is contained in:
jasper 2018-03-13 21:07:42 +00:00
parent fda920b35d
commit fd66335b40
21 changed files with 127 additions and 2900 deletions

View File

@ -1,73 +1,28 @@
# $OpenBSD: Makefile,v 1.15 2017/07/26 22:45:31 sthen Exp $
# $OpenBSD: Makefile,v 1.16 2018/03/13 21:07:42 jasper Exp $
COMMENT= c++ validating XML parser
COMMENT = validating XML parser written in a portable subset of C++
DISTNAME= xerces-c-src_2_8_0
PKGNAME= xerces-c-2.8.0
REVISION = 5
CATEGORIES= textproc devel
DISTNAME = xerces-c-3.2.1
CATEGORIES = textproc devel
SO_VERSION= 0.0 # .28.0
.for _lib in xerces-c xerces-depdom
SHARED_LIBS+= ${_lib} ${SO_VERSION}
.endfor
HOMEPAGE= http://xerces.apache.org/index.html
SHARED_LIBS += xerces-c 0.0
# Apache 2.0
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_CDROM = Yes
MASTER_SITES= http://archive.apache.org/dist/xerces/c/2/sources/
MASTER_SITES = https://www.apache.org/dist/xerces/c/3/sources/
USE_GMAKE= Yes
WANTLIB += ${COMPILER_LIBCXX} icudata icui18n icuuc m
WANTLIB= m ${COMPILER_LIBCXX}
LIB_DEPENDS = textproc/icu4c
XERCESCROOT= ${WRKDIR}/${DISTNAME}
WRKSRC= ${XERCESCROOT}/src/xercesc
CONFIGURE_STYLE = gnu
USE_GMAKE = Yes
# runConfigure is a wrapper around a GNU configure script. In order to still
# pick up our config.site defaults, use the gnu MODULE.
MODULES = gnu
CONFIGURE_SCRIPT= ${XERCESCROOT}/src/xercesc/runConfigure
CONFIGURE_STYLE= simple
CONFIGURE_ENV= XERCESCROOT="${XERCESCROOT}"
CONFIGURE_ARGS= -p openbsd -c ${CC} -x ${CXX} -m inmem -n socket \
-t native -r none -P ${PREFIX}
MAKE_ENV= XERCESCROOT="${XERCESCROOT}"
MAKE_FLAGS= SO_TARGET_VERSION=${SO_VERSION:R} \
SO_TARGET_VERSION_MAJOR=${SO_VERSION:E} \
VERBOSE=1
post-extract:
mkdir -p ${WRKSRC}/util/Platforms/OpenBSD
cp ${WRKSRC}/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp \
${WRKSRC}/util/Platforms/OpenBSD/OpenBSDPlatformUtils.cpp
cp ${FILESDIR}/{Makefile.in,OpenBSDDefs.hpp} \
${WRKSRC}/util/Platforms/OpenBSD/
chmod 0644 ${WRKSRC}/util/Platforms/OpenBSD/{Makefile.in,OpenBSDDefs.hpp}
pre-configure:
${SUBST_CMD} ${WRKSRC}/Makefile.incl
CONFIGURE_ARGS += --disable-static \
--disable-network
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/xerces-c
cp -R ${XERCESCROOT}/doc/html ${PREFIX}/share/doc/xerces-c
chown -R ${SHAREOWN}:${SHAREGRP} \
${PREFIX}/share/doc/xerces-c \
${PREFIX}/include/xercesc \
${PREFIX}/lib/*
do-test:
cd ${XERCESCROOT}/tests && \
XERCESCROOT="${XERCESCROOT}" ./runConfigure -p openbsd -c ${CC} -x ${CXX} -r none && \
XERCESCROOT="${XERCESCROOT}" ${MAKE_PROGRAM}
cd ${XERCESCROOT}/samples && \
XERCESCROOT="${XERCESCROOT}" ./runConfigure -p openbsd -c ${CC} -x ${CXX} -r none && \
XERCESCROOT="${XERCESCROOT}" ${MAKE_PROGRAM}
cd ${XERCESCROOT}/samples/data && \
PATH=${PATH}:${XERCESCROOT}/bin perl ../../scripts/sanityTest.pl
rm ${PREFIX}/lib/*.{a,la}
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (xerces-c-src_2_8_0.tar.gz) = QW6vdLvm/zs8ZKKC6IaBDK1su0hHjTyDNEZhUEwJyNY=
SIZE (xerces-c-src_2_8_0.tar.gz) = 7893039
SHA256 (xerces-c-3.2.1.tar.gz) = bdRgK4hEqeGrIG4CcJNdDJtfnYh3ECbn81DkKb0tBKA=
SIZE (xerces-c-3.2.1.tar.gz) = 7113008

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-Makefile_in,v 1.1 2018/03/13 21:07:42 jasper Exp $
Index: Makefile.in
--- Makefile.in.orig
+++ Makefile.in
@@ -414,7 +414,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = doc src tests samples
+SUBDIRS = doc src tests
EXTRA_DIST = CMakeLists.txt \
cmake \
config.h.cmake.in \

View File

@ -1,40 +0,0 @@
$OpenBSD: patch-obj_Makefile_in,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- obj/Makefile.in.orig Tue Aug 28 20:47:18 2007
+++ obj/Makefile.in Sun Oct 26 21:21:44 2008
@@ -148,12 +148,6 @@ ${FQ_REAL_NAME}: $(ALL_OBJECTS)
ifeq (${PLATFORM},OS390)
$(CP) ${LIBNAME}${VER}${OS390SIDEDECK} ${LIB}
endif
- ifneq (${FQ_SO_NAME},${FQ_REAL_NAME})
- @echo symlink ${FQ_SO_NAME}
- rm -rf ${FQ_SO_NAME} && ln -s ${FQ_REAL_NAME} ${FQ_SO_NAME}
- endif
- @echo symlink ${FQ_LINK_NAME}
- rm -rf ${FQ_LINK_NAME} && ln -s ${FQ_SO_NAME} ${FQ_LINK_NAME}
## DepDOM ##
${FQ_REAL_DEPDOM}: $(DEPDOM_OBJECTS)
@@ -170,12 +164,6 @@ ${FQ_REAL_DEPDOM}: $(DEPDOM_OBJECTS)
${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) -L${LIB} -l${LINK_LIBNAME}
endif
endif
- ifneq (${FQ_SO_DEPDOM},${FQ_REAL_DEPDOM})
- @echo symlink ${FQ_SO_DEPDOM}
- rm -rf ${FQ_SO_DEPDOM} && ln -s ${FQ_REAL_DEPDOM} ${FQ_SO_DEPDOM}
- endif
- @echo symlink ${FQ_LINK_DEPDOM}
- rm -rf ${FQ_LINK_DEPDOM} && ln -s ${FQ_SO_DEPDOM} ${FQ_LINK_DEPDOM}
## Start OS390 ##
ifeq (${PLATFORM},OS390)
@@ -266,10 +254,8 @@ ifeq (${LIBTYPE},shared)
(cd ${DESTDIR}$(PREFIX)/lib; rm -f ${LINK_DEPDOM}.a libxercesdepdom.dll.a; ln -s ${LIBDEPDOM}${SO_TARGET_VERSION}${SHLIBSUFFIX}.a ${LINK_DEPDOM}.a; rm -f libxercesdepdom.dll.a; ln -s ${LIBDEPDOM}${SO_TARGET_VERSION}${SHLIBSUFFIX}.a libxercesdepdom.dll.a)
else
$(CP) ${FQ_REAL_NAME} ${DESTDIR}$(PREFIX)/lib
- (cd ${DESTDIR}$(PREFIX)/lib; rm -f ${SO_NAME}; ln -s ${REAL_NAME} ${SO_NAME}; rm -f ${LINK_NAME}; ln -s ${REAL_NAME} ${LINK_NAME})
$(CP) ${FQ_REAL_DEPDOM} ${DESTDIR}$(PREFIX)/lib
- (cd ${DESTDIR}$(PREFIX)/lib; rm -f ${SO_DEPDOM}; ln -s ${REAL_DEPDOM} ${SO_DEPDOM}; rm -f ${LINK_DEPDOM}; ln -s ${REAL_DEPDOM} ${LINK_DEPDOM})
endif
ifeq (${PLATFORM},OS390)
$(CP) ${LIBNAME}${VER}${OS390SIDEDECK} ${DESTDIR}$(PREFIX)/lib

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-samples_Makefile_incl,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- samples/Makefile.incl.orig Sun Oct 26 19:46:07 2008
+++ samples/Makefile.incl Sun Oct 26 19:47:14 2008
@@ -284,6 +284,20 @@ ifeq (${PLATFORM}, NETBSD)
endif
endif
+#=============== OPENBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OPENBSD)
+ CMP= -c ${CXXFLAGS}
+ CC= ${COMPILER} -c -D${PLATFORM} -fPIC
+ LINK = ${COMPILER} -D${PLATFORM} -fPIC ${LDFLAGS}
+ PLATFORM_LIB_LINK_OPTIONS=-Wl,-rpath,${XERCESCROOT}/lib
+ ifdef ICUROOT
+ PLATFORM_LIB_LINK_OPTIONS+=-L${ICUROOT} -Wl,-rpath,${ICUROOT}
+ EXTRA_LINK_OPTIONS=-licudata -lstdc++ ${EXTRA_LIBS}
+ else
+ EXTRA_LINK_OPTIONS=${EXTRA_LIBS} -lstdc++
+ endif
+endif
+
#================= HP SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, HPUX)
ifeq (${GXX}, yes)

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-samples_configure,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- samples/configure.orig Sun Oct 26 19:47:29 2008
+++ samples/configure Sun Oct 26 19:47:49 2008
@@ -4236,6 +4236,7 @@ case "${host}" in
*-*-nto*) platform=QNX ;;
*-*-freebsd*) platform=FREEBSD ;;
*-*-netbsd*) platform=NETBSD ;;
+ *-*-openbsd*) platform=OPENBSD ;;
*-*-irix*) platform=IRIX ;;
*-*-aix*) platform=AIX ;;
*-*-hp*) platform=HPUX ;

View File

@ -1,40 +0,0 @@
$OpenBSD: patch-samples_runConfigure,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- samples/runConfigure.orig Sun Oct 26 22:14:08 2008
+++ samples/runConfigure Sun Oct 26 22:15:02 2008
@@ -46,7 +46,7 @@ platforms"
echo "Usage: runConfigure \"options\""
echo " where options may be any of the following:"
echo " -p <platform> (accepts 'aix', 'beos', 'linux', 'freebsd', 'netbsd',
- 'solaris', 'hp-10', 'hp-11', 'openserver', 'unixware',
+ 'openbsd', 'solaris', 'hp-10', 'hp-11', 'openserver', 'unixware',
'os400', 'os390', 'irix', 'ptx', 'tru64', 'macosx', 'cygwin', 'qnx',
'interix', 'mingw-msys')
[required: no default]"
@@ -197,7 +197,7 @@ echo "Extra link options: $linkeroptions"
# Now check if the options are correct or not, bail out if incorrect
#
case $platform in
- aix | openserver | unixware | beos | linux | freebsd | netbsd | solaris | hp-10 | hp-11 | os400 | os390 | irix | ptx | tru64 | macosx | cygwin | qnx | interix | mingw-msys)
+ aix | openserver | unixware | beos | linux | freebsd | netbsd | openbsd | solaris | hp-10 | hp-11 | os400 | os390 | irix | ptx | tru64 | macosx | cygwin | qnx | interix | mingw-msys)
# platform has been recognized
;;
*)
@@ -272,6 +272,9 @@ else
elif test $platform = "netbsd"; then
threadingLibs="-pthread"
threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
+ elif test $platform = "openbsd"; then
+ threadingLibs="-pthread"
+ threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
elif test $platform = "aix"; then
aix_version=`./config.guess`;
echo Found host system to be $aix_version
@@ -357,7 +360,7 @@ export THREADS
#
# aix | beos | linux | hp-11 | solaris |
-# hp-10 | freebsd | netbsd | irix | openserver | unixware | os400 | ptx | tru64 | macosx
+# hp-10 | freebsd | netbsd | openbsd | irix | openserver | unixware | os400 | ptx | tru64 | macosx
#
if test $bitsToBuild = 64; then
bitstobuildDefines=" -DXML_BITSTOBUILD_64 "

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_Makefile_in,v 1.1 2018/03/13 21:07:42 jasper Exp $
Index: src/Makefile.in
--- src/Makefile.in.orig
+++ src/Makefile.in
@@ -1514,7 +1514,7 @@ lib_LTLIBRARIES = libxerces-c.la
# make pretty-printing won't work.
#
AM_CPPFLAGS = $(am__append_3) $(am__append_12) $(am__append_25)
-libxerces_c_la_LDFLAGS = -release @INTERFACE_VERSION_D@
+libxerces_c_la_LDFLAGS =
# This sets {install}/include as target for the headers
libxerces_c_ladir = ${includedir}

View File

@ -1,58 +0,0 @@
$OpenBSD: patch-src_xercesc_Makefile_incl,v 1.1.1.1 2008/10/26 23:15:17 ajacoutot Exp $
--- src/xercesc/Makefile.incl.orig Thu Aug 30 14:10:20 2007
+++ src/xercesc/Makefile.incl Sun Oct 26 23:02:51 2008
@@ -627,6 +627,30 @@ ifeq (${PLATFORM}, NETBSD)
LD_SODEPDOM = -Wl,-soname,${SO_DEPDOM}
endif
+#=============== OPENBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OPENBSD)
+ PLATFORM_COMPILE_OPTIONS = -D${PLATFORM}
+
+ ifeq (${LIBTYPE},shared)
+ PLATFORM_COMPILE_OPTIONS += -fPIC
+ MAKE_SHARED = ${CXX} -D${PLATFORM} -shared -fPIC ${LDFLAGS}
+ MAKE_SHARED_C = ${CC} -D${PLATFORM} -shared -fPIC ${LDFLAGS}
+ endif
+
+ ifeq (${TRANSCODER}, ICU)
+ PLATFORM_COMPILE_OPTIONS += -I${LOCALBASE}/include
+ ALLLIBS = ${LIBS} -L${LOCALBASE}/lib -L${ICUROOT} -licuuc -licudata
+ else
+ ALLLIBS = ${LIBS}
+ endif
+
+ SHLIBSUFFIX=.so
+ ICUSHLIBSUFFIX=.so
+ ## Compiler switch to embed a library name
+ LD_SONAME = -Wl,-soname,${SO_NAME}
+ LD_SODEPDOM = -Wl,-soname,${SO_DEPDOM}
+endif
+
#=============== IRIX SPECIFIC OPTIONS ============================
ifeq (${PLATFORM}, IRIX)
PLATFORM_COMPILE_OPTIONS = -LANG:pch -LANG:std -O2 \
@@ -1084,6 +1108,23 @@ ifeq (${PLATFORM}, QNX)
LINK_DEPDOM=${LIBDEPDOM}${SHLIBSUFFIX}
SO_DEPDOM =${LIBDEPDOM}${SHLIBSUFFIX}.${SO_TARGET_VERSION}
REAL_DEPDOM=$(SO_DEPDOM)
+
+endif
+ifeq (${PLATFORM}, OPENBSD)
+ #
+ # LINK_NAME=SO_NAME=REAL_NAME=libxerces-c.{suffix}
+ #
+ LINK_NAME=${LIBNAME}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+ SO_NAME =${LIBNAME}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+ REAL_NAME=${LIBNAME}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+
+ LINK_DEPDOM=${LIBDEPDOM}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+ SO_DEPDOM =${LIBDEPDOM}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+ REAL_DEPDOM=${LIBDEPDOM}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+
+ RESLIB_LINK_NAME=${RESLIBNAME}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+ RESLIB_SO_NAME =${RESLIBNAME}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
+ RESLIB_REAL_NAME=${RESLIBNAME}${SHLIBSUFFIX}.${SO_TARGET_VERSION}.${SO_TARGET_VERSION_MAJOR}
endif

View File

@ -1,28 +0,0 @@
$OpenBSD: patch-src_xercesc_configure,v 1.1.1.1 2008/10/26 23:15:17 ajacoutot Exp $
--- src/xercesc/configure.orig Sun Oct 26 19:51:00 2008
+++ src/xercesc/configure Sun Oct 26 19:52:06 2008
@@ -3944,6 +3944,7 @@ case "${host}" in
*-*-linux*) platform=LINUX ;;
*-*-freebsd*) platform=FREEBSD ;;
*-*-netbsd*) platform=NETBSD ;;
+ *-*-openbsd*) platform=OPENBSD ;;
*-*-irix*) platform=IRIX ;;
*-*-aix*) platform=AIX
case "${host}" in
@@ -4024,7 +4025,7 @@ libtype=${LIBTYPE}
bitstobuild=${BITSTOBUILD}
-ac_config_files="$ac_config_files Makefile util/Makefile util/Transcoders/Cygwin/Makefile util/Transcoders/Win32/Makefile util/Transcoders/ICU/Makefile util/Transcoders/Iconv/Makefile util/Transcoders/Iconv390/Makefile util/Transcoders/Uniconv390/Makefile util/Transcoders/Iconv400/Makefile util/Transcoders/IconvFBSD/Makefile util/Transcoders/IconvGNU/Makefile util/Transcoders/MacOSUnicodeConverter/Makefile util/Platforms/Makefile util/Platforms/Solaris/Makefile util/Platforms/AIX/Makefile util/Platforms/BeOS/Makefile util/Platforms/QNX/Makefile util/Platforms/Linux/Makefile util/Platforms/FreeBSD/Makefile util/Platforms/NetBSD/Makefile util/Platforms/HPUX/Makefile util/Platforms/OS390/Makefile util/Platforms/OS400/Makefile util/Platforms/IRIX/Makefile util/Platforms/PTX/Makefile util/Platforms/OpenServer/Makefile util/Platforms/UnixWare/Makefile util/Platforms/Tru64/Makefile util/Platforms/MacOS/Makefile util/Platforms/Win32/Makefile util/Platforms/Cygwin/Makefile util/Compilers/Makefile util/MsgLoaders/InMemory/Makefile util/MsgLoaders/ICU/Makefile util/MsgLoaders/ICU/resources/Makefile util/MsgLoaders/MsgCatalog/Makefile util/MsgLoaders/MsgFile/Makefile util/NetAccessors/Socket/Makefile util/NetAccessors/WinSock/Makefile util/NetAccessors/libWWW/Makefile util/NetAccessors/MacOSURLAccessCF/Makefile util/regx/Makefile validators/Makefile validators/common/Makefile validators/datatype/Makefile validators/DTD/Makefile validators/schema/Makefile validators/schema/identity/Makefile framework/Makefile framework/psvi/Makefile dom/Makefile dom/impl/Makefile dom/deprecated/Makefile parsers/Makefile internal/Makefile sax/Makefile sax2/Makefile ../../obj/Makefile"
+ac_config_files="$ac_config_files Makefile util/Makefile util/Transcoders/Cygwin/Makefile util/Transcoders/Win32/Makefile util/Transcoders/ICU/Makefile util/Transcoders/Iconv/Makefile util/Transcoders/Iconv390/Makefile util/Transcoders/Uniconv390/Makefile util/Transcoders/Iconv400/Makefile util/Transcoders/IconvFBSD/Makefile util/Transcoders/IconvGNU/Makefile util/Transcoders/MacOSUnicodeConverter/Makefile util/Platforms/Makefile util/Platforms/Solaris/Makefile util/Platforms/AIX/Makefile util/Platforms/BeOS/Makefile util/Platforms/QNX/Makefile util/Platforms/Linux/Makefile util/Platforms/FreeBSD/Makefile util/Platforms/NetBSD/Makefile util/Platforms/OpenBSD/Makefile util/Platforms/HPUX/Makefile util/Platforms/OS390/Makefile util/Platforms/OS400/Makefile util/Platforms/IRIX/Makefile util/Platforms/PTX/Makefile util/Platforms/OpenServer/Makefile util/Platforms/UnixWare/Makefile util/Platforms/Tru64/Makefile util/Platforms/MacOS/Makefile util/Platforms/Win32/Makefile util/Platforms/Cygwin/Makefile util/Compilers/Makefile util/MsgLoaders/InMemory/Makefile util/MsgLoaders/ICU/Makefile util/MsgLoaders/ICU/resources/Makefile util/MsgLoaders/MsgCatalog/Makefile util/MsgLoaders/MsgFile/Makefile util/NetAccessors/Socket/Makefile util/NetAccessors/WinSock/Makefile util/NetAccessors/libWWW/Makefile util/NetAccessors/MacOSURLAccessCF/Makefile util/regx/Makefile validators/Makefile validators/common/Makefile validators/datatype/Makefile validators/DTD/Makefile validators/schema/Makefile validators/schema/identity/Makefile framework/Makefile framework/psvi/Makefile dom/Makefile dom/impl/Makefile dom/deprecated/Makefile parsers/Makefile internal/Makefile sax/Makefile sax2/Makefile ../../obj/Makefile"
ac_config_commands="$ac_config_commands default"
@@ -4625,6 +4626,7 @@ do
"util/Platforms/Linux/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/Linux/Makefile" ;;
"util/Platforms/FreeBSD/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/FreeBSD/Makefile" ;;
"util/Platforms/NetBSD/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/NetBSD/Makefile" ;;
+ "util/Platforms/OpenBSD/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/OpenBSD/Makefile" ;;
"util/Platforms/HPUX/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/HPUX/Makefile" ;;
"util/Platforms/OS390/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/OS390/Makefile" ;;
"util/Platforms/OS400/Makefile") CONFIG_FILES="$CONFIG_FILES util/Platforms/OS400/Makefile" ;;

View File

@ -1,61 +0,0 @@
$OpenBSD: patch-src_xercesc_internal_XMLReader_cpp,v 1.1 2015/03/23 14:36:38 jasper Exp $
Security fix for CVE-2015-0252: Apache Xerces-C XML Parser Crashes on Malformed Input
http://xerces.apache.org/xerces-c/secadv/CVE-2015-0252.txt
--- src/xercesc/internal/XMLReader.cpp.orig Mon Mar 23 15:29:21 2015
+++ src/xercesc/internal/XMLReader.cpp Mon Mar 23 15:31:35 2015
@@ -1430,6 +1430,17 @@ void XMLReader::doInitDecode()
while (fRawBufIndex < fRawBytesAvail)
{
+ // Security fix: make sure there are at least sizeof(UCS4Ch) bytes to consume.
+ if (fRawBufIndex + sizeof(UCS4Ch) > fRawBytesAvail) {
+ ThrowXMLwithMemMgr1
+ (
+ TranscodingException
+ , XMLExcepts::Reader_CouldNotDecodeFirstLine
+ , fSystemId
+ , fMemoryManager
+ );
+ }
+
// Get out the current 4 byte value and inc our raw buf index
UCS4Ch curVal = *asUCS++;
fRawBufIndex += sizeof(UCS4Ch);
@@ -1589,6 +1600,17 @@ void XMLReader::doInitDecode()
while (fRawBufIndex < fRawBytesAvail)
{
+ // Security fix: make sure there are at least sizeof(UTF16Ch) bytes to consume.
+ if (fRawBufIndex + sizeof(UTF16Ch) > fRawBytesAvail) {
+ ThrowXMLwithMemMgr1
+ (
+ TranscodingException
+ , XMLExcepts::Reader_CouldNotDecodeFirstLine
+ , fSystemId
+ , fMemoryManager
+ );
+ }
+
// Get out the current 2 byte value
UTF16Ch curVal = *asUTF16++;
fRawBufIndex += sizeof(UTF16Ch);
@@ -1678,6 +1700,17 @@ void XMLReader::doInitDecode()
//
void XMLReader::refreshRawBuffer()
{
+ // Security fix: make sure we don't underflow on the subtraction.
+ if (fRawBufIndex > fRawBytesAvail) {
+ ThrowXMLwithMemMgr1
+ (
+ RuntimeException
+ , XMLExcepts::Str_StartIndexPastEnd
+ , fSystemId
+ , fMemoryManager
+ );
+ }
+
//
// If there are any bytes left, move them down to the start. There
// should only ever be (max bytes per char - 1) at the most.

View File

@ -1,40 +0,0 @@
$OpenBSD: patch-src_xercesc_runConfigure,v 1.1.1.1 2008/10/26 23:15:17 ajacoutot Exp $
--- src/xercesc/runConfigure.orig Tue Aug 28 20:44:56 2007
+++ src/xercesc/runConfigure Sun Oct 26 19:35:14 2008
@@ -272,7 +272,7 @@ echo "Extra configure options: $configureoptions"
#
case $platform in
- aix | openserver | unixware | beos | linux | freebsd | netbsd | solaris | hp-10 | hp-11 | os400 | os390 | irix | ptx | tru64 | macosx | cygwin | qnx | interix | mingw-msys)
+ aix | openserver | unixware | beos | linux | freebsd | netbsd | openbsd | solaris | hp-10 | hp-11 | os400 | os390 | irix | ptx | tru64 | macosx | cygwin | qnx | interix | mingw-msys)
# platform has been recognized
;;
*)
@@ -298,6 +298,8 @@ if test $debug = "off"; then
debugflag="-DNDEBUG";
elif test $platform = "linux"; then
debugflag="-w -O2 -DNDEBUG";
+ elif test $platform = "openbsd"; then
+ debugflag="-w -DNDEBUG";
else
debugflag="-w -O -DNDEBUG";
fi
@@ -360,6 +362,9 @@ else
elif test $platform = "netbsd"; then
threadingLibs="-pthread -lpthread"
threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
+ elif test $platform = "openbsd"; then
+ threadingLibs="-pthread"
+ threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
elif test $platform = "aix"; then
aix_version=`./config.guess`;
echo Found host system to be $aix_version
@@ -446,7 +451,7 @@ export THREADS
#
# aix | beos | linux | hp-11 | solaris |
-# hp-10 | freebsd | netbsd | irix | openserver | unixware | os400 | ptx | tru64 | macosx
+# hp-10 | freebsd | openbsd | netbsd | irix | openserver | unixware | os400 | ptx | tru64 | macosx
#
if test $bitsToBuild = 64; then
bitstobuildDefines=" -DXML_BITSTOBUILD_64 "

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-src_xercesc_util_AutoSense_hpp,v 1.1.1.1 2008/10/26 23:15:17 ajacoutot Exp $
--- src/xercesc/util/AutoSense.hpp.orig Sun Oct 26 19:52:30 2008
+++ src/xercesc/util/AutoSense.hpp Sun Oct 26 19:53:28 2008
@@ -107,6 +107,9 @@
#define XML_TRU64
#elif defined(__NetBSD__)
#define XML_NETBSD
+#elif defined(__OpenBSD__)
+ #define XML_OPENBSD
+ #define XML_UNIX
#elif defined(__INTERIX)
#define XML_INTERIX
#define XML_UNIX

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-src_xercesc_util_Platforms_Makefile_in,v 1.1.1.1 2008/10/26 23:15:17 ajacoutot Exp $
--- src/xercesc/util/Platforms/Makefile.in.orig Sun Oct 26 19:54:14 2008
+++ src/xercesc/util/Platforms/Makefile.in Sun Oct 26 19:54:36 2008
@@ -155,6 +155,9 @@ endif
ifeq (${PLATFORM}, NETBSD)
SUBMODULE = NetBSD
endif
+ifeq (${PLATFORM}, OPENBSD)
+ SUBMODULE = OpenBSD
+endif
ifeq (${PLATFORM}, HPUX)
SUBMODULE = HPUX
endif

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-src_xercesc_util_XercesDefs_hpp,v 1.1.1.1 2008/10/26 23:15:17 ajacoutot Exp $
--- src/xercesc/util/XercesDefs.hpp.orig Sun Oct 26 19:55:38 2008
+++ src/xercesc/util/XercesDefs.hpp Sun Oct 26 19:56:36 2008
@@ -237,6 +237,10 @@ typedef XMLUInt32 UCS4Ch;
#include <xercesc/util/Platforms/NetBSD/NetBSDDefs.hpp>
#endif
+#if defined(XML_OPENBSD)
+#include <xercesc/util/Platforms/OpenBSD/OpenBSDDefs.hpp>
+#endif
+
// ---------------------------------------------------------------------------
// According to whether the compiler suports L"" type strings, we define
// the XMLStrL() macro one way or another.

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-src_xercesc_validators_DTD_DTDScanner_cpp,v 1.1 2016/06/28 09:34:08 jasper Exp $
Security fix for CVE-2016-2099
https://issues.apache.org/jira/browse/XERCESC-2066
--- src/xercesc/validators/DTD/DTDScanner.cpp.orig Tue Jun 28 11:07:22 2016
+++ src/xercesc/validators/DTD/DTDScanner.cpp Tue Jun 28 11:08:49 2016
@@ -2913,7 +2913,15 @@ bool DTDScanner::scanInternalSubset()
bool noErrors = true;
while (true)
{
- const XMLCh nextCh = fReaderMgr->peekNextChar();
+ XMLCh nextCh;
+
+ try {
+ nextCh = fReaderMgr->peekNextChar();
+ }
+ catch (XMLException& ex) {
+ fScanner->emitError(XMLErrs::XMLException_Fatal, ex.getCode(), ex.getMessage(), NULL, NULL);
+ nextCh = chNull;
+ }
//
// If we get an end of file marker, just unget it and return a

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-tests_Makefile_incl,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- tests/Makefile.incl.orig Sun Oct 26 19:56:59 2008
+++ tests/Makefile.incl Sun Oct 26 19:57:29 2008
@@ -283,6 +283,20 @@ ifeq (${PLATFORM}, NETBSD)
endif
endif
+#=============== OPENBSD SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, OPENBSD)
+ CMP= -c ${CXXFLAGS}
+ CC= ${COMPILER} -c -D${PLATFORM} -fPIC
+ LINK = ${COMPILER} -D${PLATFORM} -fPIC ${LDFLAGS}
+ PLATFORM_LIB_LINK_OPTIONS=-Wl,-rpath,${XERCESCROOT}/lib
+ ifdef ICUROOT
+ PLATFORM_LIB_LINK_OPTIONS+=-L${ICUROOT} -Wl,-rpath,${ICUROOT}
+ EXTRA_LINK_OPTIONS=-licudata -lstdc++ ${EXTRA_LIBS}
+ else
+ EXTRA_LINK_OPTIONS=${EXTRA_LIBS} -lstdc++
+ endif
+endif
+
#================= HP SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, HPUX)
ifeq (${GXX}, yes)

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-tests_configure,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- tests/configure.orig Sun Oct 26 19:58:34 2008
+++ tests/configure Sun Oct 26 19:58:47 2008
@@ -4236,6 +4236,7 @@ case "${host}" in
*-*-nto*) platform=QNX ;;
*-*-freebsd*) platform=FREEBSD ;;
*-*-netbsd*) platform=NETBSD ;;
+ *-*-openbsd*) platform=OPENBSD ;;
*-*-irix*) platform=IRIX ;;
*-*-aix*) platform=AIX ;;
*-*-hp*) platform=HPUX ;

View File

@ -1,31 +0,0 @@
$OpenBSD: patch-tests_runConfigure,v 1.1.1.1 2008/10/26 23:15:18 ajacoutot Exp $
--- tests/runConfigure.orig Sun Oct 26 19:59:26 2008
+++ tests/runConfigure Sun Oct 26 20:00:24 2008
@@ -45,7 +45,7 @@ usage()
echo "Usage: runConfigure \"options\""
echo " where options may be any of the following:"
echo " -p <platform> (accepts 'aix', 'beos', 'linux', 'freebsd', 'netbsd',
- 'solaris', 'hp-10', 'hp-11', 'openserver', 'unixware',
+ 'openbsd', 'solaris', 'hp-10', 'hp-11', 'openserver', 'unixware',
'os400', 'os390', 'irix', 'ptx', 'tru64', 'macosx', 'cygwin', 'qnx',
'interix', 'mingw-msys')
[required: no default]"
@@ -196,7 +196,7 @@ echo "Extra link options: $linkeroptions"
# Now check if the options are correct or not, bail out if incorrect
#
case $platform in
- aix | openserver | unixware | beos | linux | freebsd | netbsd | solaris | hp-10 | hp-11 | os400 | os390 | irix | ptx | tru64 | macosx | cygwin | qnx | interix | mingw-msys)
+ aix | openserver | unixware | beos | linux | freebsd | netbsd | openbsd | solaris | hp-10 | hp-11 | os400 | os390 | irix | ptx | tru64 | macosx | cygwin | qnx | interix | mingw-msys)
# platform has been recognized
;;
*)
@@ -269,6 +269,9 @@ else
threadingLibs="-pthread -lc_r"
threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
elif test $platform = "netbsd"; then
+ threadingLibs="-pthread"
+ threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
+ elif test $platform = "openbsd"; then
threadingLibs="-pthread"
threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
elif test $platform = "aix"; then

View File

@ -1,13 +1,5 @@
Xerces-C++ is a validating XML parser written in a portable subset of
C++. Xerces-C++ makes it easy to give your application the ability to
read and write XML data. A shared library is provided for parsing,
C++. Xerces-C++ makes it easy to give your application the ability to
read and write XML data. A shared library is provided for parsing,
generating, manipulating, and validating XML documents using the DOM,
SAX, and SAX2 APIs. For an introduction to programming with Xerces-C++
refer to the Programming Guide.
Xerces-C++ is faithful to the XML 1.0 recommendation and many associated
standards.
The parser provides high performance, modularity, and scalability.
Source code, samples and API documentation are provided with the parser.
For portability, care has been taken to make minimal use of templates,
no RTTI, and minimal use of #ifdefs.
SAX, and SAX2 APIs.

File diff suppressed because it is too large Load Diff