Changes 2.9.0:
Features: * A few new API entry points, * More resilient push parser mode, * A lot of portability improvement, * Faster XPath evaluation
This commit is contained in:
parent
8ace00dcd8
commit
62e46e6e63
14 changed files with 58 additions and 431 deletions
|
@ -1,11 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.119 2012/08/01 14:51:37 drochner Exp $
|
||||
# $NetBSD: Makefile,v 1.120 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
DISTNAME= libxml2-2.8.0
|
||||
PKGREVISION= 3
|
||||
DISTNAME= libxml2-2.9.0
|
||||
CATEGORIES= textproc
|
||||
MASTER_SITES= ftp://xmlsoft.org/libxml2/ \
|
||||
http://xmlsoft.org/sources/
|
||||
#MASTER_SITES= ${MASTER_SITE_GNOME:=sources/libxml2/2.7/}
|
||||
|
||||
MAINTAINER= pkgsrc-users@NetBSD.org
|
||||
HOMEPAGE= http://xmlsoft.org/
|
||||
|
@ -15,16 +13,16 @@ LICENSE= modified-bsd
|
|||
PKG_INSTALLATION_TYPES= overwrite pkgviews
|
||||
PKG_DESTDIR_SUPPORT= user-destdir
|
||||
|
||||
USE_TOOLS+= gmake
|
||||
USE_FEATURES= glob
|
||||
USE_LIBTOOL= yes
|
||||
PKGCONFIG_OVERRIDE= libxml-2.0.pc.in
|
||||
|
||||
USE_TOOLS+= gmake
|
||||
GNU_CONFIGURE= yes
|
||||
CONFIGURE_ARGS+= --with-iconv=${BUILDLINK_PREFIX.iconv}
|
||||
CONFIGURE_ARGS+= --with-html-subdir=libxml2
|
||||
CONFIGURE_ARGS+= --with-iconv=${BUILDLINK_PREFIX.iconv}
|
||||
CONFIGURE_ARGS+= --without-python
|
||||
|
||||
PKGCONFIG_OVERRIDE= libxml-2.0.pc.in
|
||||
|
||||
.include "options.mk"
|
||||
|
||||
# allow thread-awareness, but make sure the library is not
|
||||
|
@ -43,10 +41,9 @@ SUBST_FILES.cat= catalog.c xmlcatalog.c
|
|||
SUBST_SED.cat= -e "s,@@SGML_DEFAULT_CATALOG@@,${SGML_DEFAULT_CATALOG},g"
|
||||
SUBST_SED.cat+= -e "s,@@XML_DEFAULT_CATALOG@@,${XML_DEFAULT_CATALOG},g"
|
||||
|
||||
.include "../../mk/pthread.buildlink3.mk"
|
||||
.include "../../archivers/xz/buildlink3.mk"
|
||||
.include "../../devel/zlib/buildlink3.mk"
|
||||
.include "../../converters/libiconv/buildlink3.mk"
|
||||
.include "../../devel/zlib/buildlink3.mk"
|
||||
.include "../../textproc/xmlcatmgr/catalogs.mk"
|
||||
|
||||
.include "../../mk/pthread.buildlink3.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@comment $NetBSD: PLIST,v 1.42 2012/06/03 22:18:33 wiz Exp $
|
||||
@comment $NetBSD: PLIST,v 1.43 2012/09/15 10:23:38 adam Exp $
|
||||
bin/xml2-config
|
||||
bin/xmlcatalog
|
||||
bin/xmllint
|
||||
|
@ -117,7 +117,6 @@ share/doc/libxml2/html/libxml-xmlwriter.html
|
|||
share/doc/libxml2/html/libxml-xpath.html
|
||||
share/doc/libxml2/html/libxml-xpathInternals.html
|
||||
share/doc/libxml2/html/libxml-xpointer.html
|
||||
share/doc/libxml2/html/libxml-xzlib.html
|
||||
share/doc/libxml2/html/right.png
|
||||
share/doc/libxml2/html/up.png
|
||||
share/doc/libxml2/io1.c
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
$NetBSD: distinfo,v 1.94 2012/08/01 14:51:37 drochner Exp $
|
||||
$NetBSD: distinfo,v 1.95 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
SHA1 (libxml2-2.8.0.tar.gz) = a0c553bd51ba79ab6fff26dc700004c6a41f5250
|
||||
RMD160 (libxml2-2.8.0.tar.gz) = 45820c9f4939f642a87be9259c55fd081ea6759a
|
||||
Size (libxml2-2.8.0.tar.gz) = 4915203 bytes
|
||||
SHA1 (patch-aa) = 9e19e9218d2e209bf49e9491842c8097005eba65
|
||||
SHA1 (patch-ab) = df6ced03469ca56bc9e1e4227557163c94cfb014
|
||||
SHA1 (patch-ac) = 264c75cf9fff5319105b971c122cdf5fc103c04e
|
||||
SHA1 (libxml2-2.9.0.tar.gz) = a43d7c0a8e463ac5a7846254f2a732a9af146fab
|
||||
RMD160 (libxml2-2.9.0.tar.gz) = d025639320bb34adbc45a43f46354190f6bbb7b5
|
||||
Size (libxml2-2.9.0.tar.gz) = 5161069 bytes
|
||||
SHA1 (patch-aa) = 6fcfb2e1ac374a7a047ee188a61ef218106ee54a
|
||||
SHA1 (patch-ab) = c399ed5bfd429c2bac1de6f500d2ef47ab06f2fd
|
||||
SHA1 (patch-ac) = 101cd554fd22e8e9817e21591240eb784b1219b5
|
||||
SHA1 (patch-ad) = cd45da492b02cce9983c46762839f68b8b1e0177
|
||||
SHA1 (patch-ae) = b8d8e0275cab3caafd98275ac22b63951fc4b5fd
|
||||
SHA1 (patch-ag) = 30ec5c8daece4aba75a02bbc13db5373542dea7b
|
||||
SHA1 (patch-aj) = faa126261b388aeed3a83c4d9c0b127629dd93ab
|
||||
SHA1 (patch-am) = ae7ab69b7bba2271d2d996161cc8b9956d0b06fa
|
||||
SHA1 (patch-ba) = 0866f7a4f9639b2b9c50b4c4cb30d5445f453adc
|
||||
SHA1 (patch-bb) = 1a5d07c618db2ad56b3b4f39f54bd3d0d4a37403
|
||||
SHA1 (patch-testapi.c) = 63a0a34c8ca98d9214c4d3391e97d9a9ca4569f8
|
||||
SHA1 (patch-threads.c) = 38bf7d702c21057795eec88d4e239b5df598382d
|
||||
SHA1 (patch-ae) = 035e015abf401b15af9bf052a108a1c7b8db6c79
|
||||
SHA1 (patch-ag) = 19afd69713298ecbd247ba733a7c0c13464ae572
|
||||
SHA1 (patch-aj) = 988c30b4b09a1cbaf9e7db02bb8981da0f1beaa7
|
||||
SHA1 (patch-threads.c) = ed7339037e857707cf20217fa4c191d071e492f3
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-aa,v 1.25 2012/04/03 09:08:33 obache Exp $
|
||||
$NetBSD: patch-aa,v 1.26 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
--- Makefile.in.orig 2010-11-04 17:28:16.000000000 +0000
|
||||
+++ Makefile.in
|
||||
@@ -714,7 +714,7 @@ pkgconfig_DATA = libxml-2.0.pc
|
||||
@@ -743,7 +743,7 @@ pkgconfig_DATA = libxml-2.0.pc
|
||||
#
|
||||
BASE_DIR = $(datadir)/doc
|
||||
DOC_MODULE = libxml2-$(VERSION)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-ab,v 1.24 2012/06/03 22:18:34 wiz Exp $
|
||||
$NetBSD: patch-ab,v 1.25 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
--- configure.orig 2012-05-23 08:56:30.000000000 +0000
|
||||
--- configure.orig 2012-09-11 06:55:35.000000000 +0000
|
||||
+++ configure
|
||||
@@ -14088,7 +14088,7 @@ fi
|
||||
@@ -13971,7 +13971,7 @@ fi
|
||||
fi
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@ $NetBSD: patch-ab,v 1.24 2012/06/03 22:18:34 wiz Exp $
|
|||
XML_INCLUDEDIR='-I${includedir}/libxml2'
|
||||
|
||||
XML_CFLAGS=""
|
||||
@@ -14553,13 +14553,13 @@ else
|
||||
@@ -14436,13 +14436,13 @@ else
|
||||
if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_pthread_h" = xyes; then :
|
||||
|
@ -28,7 +28,7 @@ $NetBSD: patch-ab,v 1.24 2012/06/03 22:18:34 wiz Exp $
|
|||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -14591,7 +14591,7 @@ fi
|
||||
@@ -14474,7 +14474,7 @@ fi
|
||||
$as_echo "$ac_cv_lib_pthread_pthread_join" >&6; }
|
||||
if test "x$ac_cv_lib_pthread_pthread_join" = xyes; then :
|
||||
|
||||
|
@ -37,7 +37,7 @@ $NetBSD: patch-ab,v 1.24 2012/06/03 22:18:34 wiz Exp $
|
|||
|
||||
$as_echo "#define HAVE_LIBPTHREAD /**/" >>confdefs.h
|
||||
|
||||
@@ -14613,12 +14613,12 @@ fi
|
||||
@@ -14496,12 +14496,12 @@ fi
|
||||
*beos*) WITH_THREADS="1"
|
||||
THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
|
||||
;;
|
||||
|
@ -52,7 +52,7 @@ $NetBSD: patch-ab,v 1.24 2012/06/03 22:18:34 wiz Exp $
|
|||
if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
|
||||
then
|
||||
THREAD_LIBS=""
|
||||
@@ -14635,6 +14635,10 @@ fi
|
||||
@@ -14518,6 +14518,10 @@ fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
@ -63,7 +63,7 @@ $NetBSD: patch-ab,v 1.24 2012/06/03 22:18:34 wiz Exp $
|
|||
esac
|
||||
if test "$WITH_THREADS" = "1" ; then
|
||||
THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
|
||||
@@ -15310,10 +15314,6 @@ case "$host" in
|
||||
@@ -15209,10 +15213,6 @@ case "$host" in
|
||||
|
||||
$as_echo "#define _WINSOCKAPI_ 1" >>confdefs.h
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-ac,v 1.6 2005/07/12 21:15:21 recht Exp $
|
||||
$NetBSD: patch-ac,v 1.7 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
--- catalog.c.orig 2005-04-01 15:15:01.000000000 +0200
|
||||
+++ catalog.c
|
||||
@@ -62,10 +62,10 @@
|
||||
@@ -70,10 +70,10 @@
|
||||
#define XML_URN_PUBID "urn:publicid:"
|
||||
#define XML_CATAL_BREAK ((xmlChar *) -1)
|
||||
#ifndef XML_XML_DEFAULT_CATALOG
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
$NetBSD: patch-ae,v 1.11 2010/11/25 13:18:39 drochner Exp $
|
||||
$NetBSD: patch-ae,v 1.12 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
--- doc/examples/Makefile.in.orig 2010-11-04 17:28:16.000000000 +0000
|
||||
--- doc/examples/Makefile.in.orig 2012-09-11 06:55:36.000000000 +0000
|
||||
+++ doc/examples/Makefile.in
|
||||
@@ -791,7 +791,8 @@ index.html: examples.xml examples.xsl
|
||||
@@ -822,7 +822,7 @@ uninstall-am:
|
||||
|
||||
install-data-local:
|
||||
@MKDIR_P@ $(DESTDIR)$(HTML_DIR)
|
||||
- -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
|
||||
+ -@INSTALL@ -m 0644 $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
|
||||
+ -@INSTALL@ -m 0644 $(srcdir)/*.html $(DESTDIR)$(HTML_DIR)
|
||||
$(MKDIR_P) $(DESTDIR)$(HTML_DIR)
|
||||
- -$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
|
||||
+ -$(INSTALL) -m 0644 $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
|
||||
|
||||
valgrind:
|
||||
$(MAKE) CHECKER='valgrind' tests
|
||||
clean-local:
|
||||
test -f Makefile.am || rm -f test?.xml
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-ag,v 1.10 2012/06/03 22:18:34 wiz Exp $
|
||||
$NetBSD: patch-ag,v 1.11 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
--- encoding.c.orig 2009-09-24 17:31:59.000000000 +0200
|
||||
+++ encoding.c
|
||||
@@ -1376,6 +1376,9 @@ xmlInitCharEncodingHandlers(void) {
|
||||
@@ -1433,6 +1433,9 @@ xmlInitCharEncodingHandlers(void) {
|
||||
xmlRegisterCharEncodingHandlersISO8859x ();
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
$NetBSD: patch-aj,v 1.2 2012/06/03 22:18:34 wiz Exp $
|
||||
$NetBSD: patch-aj,v 1.3 2012/09/15 10:23:38 adam Exp $
|
||||
|
||||
Inlucde resolv.h conditionally:
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=617053
|
||||
|
||||
--- nanohttp.c.orig 2012-05-11 02:09:01.000000000 +0000
|
||||
--- nanohttp.c.orig 2012-09-11 04:23:25.000000000 +0000
|
||||
+++ nanohttp.c
|
||||
@@ -43,8 +43,10 @@
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
|
@ -14,5 +14,5 @@ Inlucde resolv.h conditionally:
|
|||
#endif
|
||||
+#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD: patch-am,v 1.1 2012/02/22 11:10:18 drochner Exp $
|
||||
|
||||
--- runtest.c.orig 2010-10-12 06:25:32.000000000 +0000
|
||||
+++ runtest.c
|
||||
@@ -3936,7 +3936,7 @@ thread_specific_data(void *private_data)
|
||||
return ((void *) Okay);
|
||||
}
|
||||
|
||||
-#if defined(linux) || defined(__sun) || defined(__APPLE_CC__)
|
||||
+#if defined(linux) || defined(__sun) || defined(__APPLE_CC__) || defined(__NetBSD__)
|
||||
|
||||
#include <pthread.h>
|
||||
|
|
@ -1,255 +0,0 @@
|
|||
$NetBSD: patch-ba,v 1.1 2012/08/01 14:51:37 drochner Exp $
|
||||
|
||||
upstream commit 459eeb9dc752d5185f57ff6b135027f11981a626
|
||||
for CVE-2012-2807
|
||||
|
||||
--- parser.c.orig 2012-05-18 07:30:30.000000000 +0000
|
||||
+++ parser.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
+#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
@@ -117,10 +118,10 @@ xmlCreateEntityParserCtxtInternal(const
|
||||
* parser option.
|
||||
*/
|
||||
static int
|
||||
-xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long size,
|
||||
+xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
|
||||
xmlEntityPtr ent)
|
||||
{
|
||||
- unsigned long consumed = 0;
|
||||
+ size_t consumed = 0;
|
||||
|
||||
if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE))
|
||||
return (0);
|
||||
@@ -2589,15 +2590,17 @@ xmlParserHandlePEReference(xmlParserCtxt
|
||||
|
||||
/*
|
||||
* Macro used to grow the current buffer.
|
||||
+ * buffer##_size is expected to be a size_t
|
||||
+ * mem_error: is expected to handle memory allocation failures
|
||||
*/
|
||||
#define growBuffer(buffer, n) { \
|
||||
xmlChar *tmp; \
|
||||
- buffer##_size *= 2; \
|
||||
- buffer##_size += n; \
|
||||
- tmp = (xmlChar *) \
|
||||
- xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
||||
+ size_t new_size = buffer##_size * 2 + n; \
|
||||
+ if (new_size < buffer##_size) goto mem_error; \
|
||||
+ tmp = (xmlChar *) xmlRealloc(buffer, new_size); \
|
||||
if (tmp == NULL) goto mem_error; \
|
||||
buffer = tmp; \
|
||||
+ buffer##_size = new_size; \
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2623,14 +2626,14 @@ xmlChar *
|
||||
xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
||||
int what, xmlChar end, xmlChar end2, xmlChar end3) {
|
||||
xmlChar *buffer = NULL;
|
||||
- int buffer_size = 0;
|
||||
+ size_t buffer_size = 0;
|
||||
+ size_t nbchars = 0;
|
||||
|
||||
xmlChar *current = NULL;
|
||||
xmlChar *rep = NULL;
|
||||
const xmlChar *last;
|
||||
xmlEntityPtr ent;
|
||||
int c,l;
|
||||
- int nbchars = 0;
|
||||
|
||||
if ((ctxt == NULL) || (str == NULL) || (len < 0))
|
||||
return(NULL);
|
||||
@@ -2647,7 +2650,7 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
* allocate a translation buffer.
|
||||
*/
|
||||
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
|
||||
- buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar));
|
||||
+ buffer = (xmlChar *) xmlMallocAtomic(buffer_size);
|
||||
if (buffer == NULL) goto mem_error;
|
||||
|
||||
/*
|
||||
@@ -2667,7 +2670,7 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
if (val != 0) {
|
||||
COPY_BUF(0,buffer,nbchars,val);
|
||||
}
|
||||
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
|
||||
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
||||
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
||||
}
|
||||
} else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) {
|
||||
@@ -2685,7 +2688,7 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
||||
if (ent->content != NULL) {
|
||||
COPY_BUF(0,buffer,nbchars,ent->content[0]);
|
||||
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
|
||||
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
||||
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
||||
}
|
||||
} else {
|
||||
@@ -2702,8 +2705,7 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
current = rep;
|
||||
while (*current != 0) { /* non input consuming loop */
|
||||
buffer[nbchars++] = *current++;
|
||||
- if (nbchars >
|
||||
- buffer_size - XML_PARSER_BUFFER_SIZE) {
|
||||
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
||||
if (xmlParserEntityCheck(ctxt, nbchars, ent))
|
||||
goto int_error;
|
||||
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
||||
@@ -2717,7 +2719,7 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
const xmlChar *cur = ent->name;
|
||||
|
||||
buffer[nbchars++] = '&';
|
||||
- if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) {
|
||||
+ if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
||||
growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE);
|
||||
}
|
||||
for (;i > 0;i--)
|
||||
@@ -2745,8 +2747,7 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
current = rep;
|
||||
while (*current != 0) { /* non input consuming loop */
|
||||
buffer[nbchars++] = *current++;
|
||||
- if (nbchars >
|
||||
- buffer_size - XML_PARSER_BUFFER_SIZE) {
|
||||
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
||||
if (xmlParserEntityCheck(ctxt, nbchars, ent))
|
||||
goto int_error;
|
||||
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
||||
@@ -2759,8 +2760,8 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
||||
} else {
|
||||
COPY_BUF(l,buffer,nbchars,c);
|
||||
str += l;
|
||||
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
|
||||
- growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
||||
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
||||
+ growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
if (str < last)
|
||||
@@ -3764,8 +3765,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
xmlChar limit = 0;
|
||||
xmlChar *buf = NULL;
|
||||
xmlChar *rep = NULL;
|
||||
- int len = 0;
|
||||
- int buf_size = 0;
|
||||
+ size_t len = 0;
|
||||
+ size_t buf_size = 0;
|
||||
int c, l, in_space = 0;
|
||||
xmlChar *current = NULL;
|
||||
xmlEntityPtr ent;
|
||||
@@ -3787,7 +3788,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
* allocate a translation buffer.
|
||||
*/
|
||||
buf_size = XML_PARSER_BUFFER_SIZE;
|
||||
- buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar));
|
||||
+ buf = (xmlChar *) xmlMallocAtomic(buf_size);
|
||||
if (buf == NULL) goto mem_error;
|
||||
|
||||
/*
|
||||
@@ -3804,7 +3805,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
|
||||
if (val == '&') {
|
||||
if (ctxt->replaceEntities) {
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
buf[len++] = '&';
|
||||
@@ -3813,7 +3814,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
* The reparsing will be done in xmlStringGetNodeList()
|
||||
* called by the attribute() function in SAX.c
|
||||
*/
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
buf[len++] = '&';
|
||||
@@ -3823,7 +3824,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
buf[len++] = ';';
|
||||
}
|
||||
} else if (val != 0) {
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
len += xmlCopyChar(0, &buf[len], val);
|
||||
@@ -3835,7 +3836,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
ctxt->nbentities += ent->owner;
|
||||
if ((ent != NULL) &&
|
||||
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
if ((ctxt->replaceEntities == 0) &&
|
||||
@@ -3863,7 +3864,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
current++;
|
||||
} else
|
||||
buf[len++] = *current++;
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
}
|
||||
@@ -3871,7 +3872,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
rep = NULL;
|
||||
}
|
||||
} else {
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
if (ent->content != NULL)
|
||||
@@ -3899,7 +3900,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
* Just output the reference
|
||||
*/
|
||||
buf[len++] = '&';
|
||||
- while (len > buf_size - i - 10) {
|
||||
+ while (len + i + 10 > buf_size) {
|
||||
growBuffer(buf, i + 10);
|
||||
}
|
||||
for (;i > 0;i--)
|
||||
@@ -3912,7 +3913,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
if ((len != 0) || (!normalize)) {
|
||||
if ((!normalize) || (!in_space)) {
|
||||
COPY_BUF(l,buf,len,0x20);
|
||||
- while (len > buf_size - 10) {
|
||||
+ while (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
}
|
||||
@@ -3921,7 +3922,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
} else {
|
||||
in_space = 0;
|
||||
COPY_BUF(l,buf,len,c);
|
||||
- if (len > buf_size - 10) {
|
||||
+ if (len + 10 > buf_size) {
|
||||
growBuffer(buf, 10);
|
||||
}
|
||||
}
|
||||
@@ -3946,7 +3947,18 @@ xmlParseAttValueComplex(xmlParserCtxtPtr
|
||||
}
|
||||
} else
|
||||
NEXT;
|
||||
- if (attlen != NULL) *attlen = len;
|
||||
+
|
||||
+ /*
|
||||
+ * There we potentially risk an overflow, don't allow attribute value of
|
||||
+ * lenght more than INT_MAX it is a very reasonnable assumption !
|
||||
+ */
|
||||
+ if (len >= INT_MAX) {
|
||||
+ xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
|
||||
+ "AttValue lenght too long\n");
|
||||
+ goto mem_error;
|
||||
+ }
|
||||
+
|
||||
+ if (attlen != NULL) *attlen = (int) len;
|
||||
return(buf);
|
||||
|
||||
mem_error:
|
|
@ -1,93 +0,0 @@
|
|||
$NetBSD: patch-bb,v 1.1 2012/08/01 14:51:37 drochner Exp $
|
||||
|
||||
upstream commits 4f9fdc709c4861c390cd84e2ed1fd878b3442e28
|
||||
and baaf03f80f817bb34c421421e6cb4d68c353ac9a
|
||||
related to CVE-2012-2807
|
||||
|
||||
--- entities.c.orig 2010-02-15 10:58:14.000000000 +0000
|
||||
+++ entities.c
|
||||
@@ -528,13 +528,13 @@ xmlGetDocEntity(xmlDocPtr doc, const xml
|
||||
* Macro used to grow the current buffer.
|
||||
*/
|
||||
#define growBufferReentrant() { \
|
||||
- buffer_size *= 2; \
|
||||
- buffer = (xmlChar *) \
|
||||
- xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
|
||||
- if (buffer == NULL) { \
|
||||
- xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");\
|
||||
- return(NULL); \
|
||||
- } \
|
||||
+ xmlChar *tmp; \
|
||||
+ size_t new_size = buffer_size * 2; \
|
||||
+ if (new_size < buffer_size) goto mem_error; \
|
||||
+ tmp = (xmlChar *) xmlRealloc(buffer, new_size); \
|
||||
+ if (tmp == NULL) goto mem_error; \
|
||||
+ buffer = tmp; \
|
||||
+ buffer_size = new_size; \
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
||||
const xmlChar *cur = input;
|
||||
xmlChar *buffer = NULL;
|
||||
xmlChar *out = NULL;
|
||||
- int buffer_size = 0;
|
||||
+ size_t buffer_size = 0;
|
||||
int html = 0;
|
||||
|
||||
if (input == NULL) return(NULL);
|
||||
@@ -574,8 +574,8 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
||||
out = buffer;
|
||||
|
||||
while (*cur != '\0') {
|
||||
- if (out - buffer > buffer_size - 100) {
|
||||
- int indx = out - buffer;
|
||||
+ size_t indx = out - buffer;
|
||||
+ if (indx + 100 > buffer_size) {
|
||||
|
||||
growBufferReentrant();
|
||||
out = &buffer[indx];
|
||||
@@ -692,6 +692,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc
|
||||
}
|
||||
*out = 0;
|
||||
return(buffer);
|
||||
+
|
||||
+mem_error:
|
||||
+ xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");
|
||||
+ xmlFree(buffer);
|
||||
+ return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -709,7 +714,7 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTR
|
||||
const xmlChar *cur = input;
|
||||
xmlChar *buffer = NULL;
|
||||
xmlChar *out = NULL;
|
||||
- int buffer_size = 0;
|
||||
+ size_t buffer_size = 0;
|
||||
if (input == NULL) return(NULL);
|
||||
|
||||
/*
|
||||
@@ -724,8 +729,8 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTR
|
||||
out = buffer;
|
||||
|
||||
while (*cur != '\0') {
|
||||
- if (out - buffer > buffer_size - 10) {
|
||||
- int indx = out - buffer;
|
||||
+ size_t indx = out - buffer;
|
||||
+ if (indx + 10 > buffer_size) {
|
||||
|
||||
growBufferReentrant();
|
||||
out = &buffer[indx];
|
||||
@@ -774,6 +779,11 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTR
|
||||
}
|
||||
*out = 0;
|
||||
return(buffer);
|
||||
+
|
||||
+mem_error:
|
||||
+ xmlEntitiesErrMemory("xmlEncodeSpecialChars: realloc failed");
|
||||
+ xmlFree(buffer);
|
||||
+ return(NULL);
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD: patch-testapi.c,v 1.1 2012/01/23 08:10:56 joerg Exp $
|
||||
|
||||
--- testapi.c.orig 2012-01-20 23:15:01.000000000 +0000
|
||||
+++ testapi.c
|
||||
@@ -291,7 +291,7 @@ static void des_long(int no ATTRIBUTE_UN
|
||||
static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
|
||||
if (no == 0) return('a');
|
||||
if (no == 1) return(' ');
|
||||
- if (no == 2) return((xmlChar) 'ø');
|
||||
+ if (no == 2) return((xmlChar)0xf8);
|
||||
return(0);
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
$NetBSD: patch-threads.c,v 1.2 2012/04/27 15:05:02 mishka Exp $
|
||||
$NetBSD: patch-threads.c,v 1.3 2012/09/15 10:23:39 adam Exp $
|
||||
|
||||
* Treat OpenBSD and MirBSD same as Linux to avoid linking with libpthread.
|
||||
* NetBSD<4.99.36 and FreeBSD<7.0 lack pthread_equal() stub function in libc.
|
||||
* Treat OpenBSD and MirBSD same as Linux to avoid linking with libpthread
|
||||
* NetBSD<4.99.36 and FreeBSD<7.0 lack pthread_equal() stub function in libc
|
||||
* pthread_once_t cast needed to avoid compilation error
|
||||
|
||||
--- threads.c.orig 2010-10-15 17:28:30.000000000 +0000
|
||||
+++ threads.c
|
||||
|
@ -35,3 +36,12 @@ $NetBSD: patch-threads.c,v 1.2 2012/04/27 15:05:02 mishka Exp $
|
|||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
@@ -915,7 +923,7 @@ xmlCleanupThreads(void)
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
if ((libxml_is_threaded) && (pthread_key_delete != NULL))
|
||||
pthread_key_delete(globalkey);
|
||||
- once_control = PTHREAD_ONCE_INIT;
|
||||
+ once_control = (pthread_once_t)PTHREAD_ONCE_INIT;
|
||||
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
|
||||
if (globalkey != TLS_OUT_OF_INDEXES) {
|
||||
xmlGlobalStateCleanupHelperParams *p;
|
||||
|
|
Loading…
Reference in a new issue