Skip to content

Commit b731f7c

Browse files
committed
Merge commit 'bc5a5d658320c37e206fe4e7b525b4a24466d0c6'
2 parents 3bb105a + bc5a5d6 commit b731f7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1068
-1268
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.exe
12
*.o
23
*.lo
34
*.log
@@ -78,6 +79,7 @@ python/libxml2.py
7879
python/libxml2class.py
7980
python/libxml2class.txt
8081
python/libxml2mod.la
82+
python/setup.py
8183
python/tests/Makefile
8284
python/tests/Makefile.in
8385
python/tests/tmp.xml

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ addons:
88
matrix:
99
include:
1010
# Try to emulate a C89 compiler on a POSIX system by disabling as many
11-
# GNU extensions as possible. -Dlinux is required to make the weak
12-
# pthread symbols work.
11+
# GNU extensions as possible.
1312
- compiler: gcc
1413
env: CFLAGS="-O2 -std=c89 -D_POSIX_C_SOURCE=200809L"
1514
# clang with AddressSanitizer and UndefinedBehaviorSanitizer.
1615
- compiler: clang
1716
dist: trusty
1817
env: CONFIG="--without-python"
19-
CFLAGS="-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover"
18+
CFLAGS="-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=all"
2019
UBSAN_OPTIONS=print_stacktrace=1
2120
script: sh autogen.sh $CONFIG && make -j2 V=1 && make check
2221
git:

SAX2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <stdlib.h>
1313
#include <string.h>
1414
#include <limits.h>
15+
#include <stddef.h>
1516
#include <libxml/xmlmemory.h>
1617
#include <libxml/tree.h>
1718
#include <libxml/parser.h>
@@ -1914,7 +1915,7 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
19141915
else {
19151916
ret->line = 65535;
19161917
if (ctxt->options & XML_PARSE_BIG_LINES)
1917-
ret->psvi = (void *) (long) ctxt->input->line;
1918+
ret->psvi = (void *) (ptrdiff_t) ctxt->input->line;
19181919
}
19191920
}
19201921
}

catalog.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
23962396
case SGML_CATA_ENTITY:
23972397
if (*cur == '%')
23982398
type = SGML_CATA_PENTITY;
2399+
/* Falls through. */
23992400
case SGML_CATA_PENTITY:
24002401
case SGML_CATA_DOCTYPE:
24012402
case SGML_CATA_LINKTYPE:

configure.ac

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AC_CANONICAL_HOST
99

1010
LIBXML_MAJOR_VERSION=2
1111
LIBXML_MINOR_VERSION=9
12-
LIBXML_MICRO_VERSION=6
12+
LIBXML_MICRO_VERSION=7
1313
LIBXML_MICRO_VERSION_SUFFIX=
1414
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
1515
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -1053,9 +1053,9 @@ if test "$with_threads" = "no" ; then
10531053
else
10541054
echo Enabling multithreaded support
10551055

1056-
dnl Default to native threads on Win32
1056+
dnl Default to native threads on Windows
10571057
case $host_os in
1058-
*mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
1058+
*mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
10591059
WITH_THREADS="1"
10601060
THREADS_W32="1"
10611061
THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
@@ -1640,7 +1640,6 @@ case "$host" in
16401640
CPPFLAGS="$CPPFLAGS -DWIN32"
16411641
WIN32_EXTRA_LIBADD="-lws2_32"
16421642
WIN32_EXTRA_LDFLAGS="-no-undefined"
1643-
AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
16441643
if test "${PYTHON}" != ""
16451644
then
16461645
WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"

dict.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#else
4949
#ifdef HAVE_INTTYPES_H
5050
#include <inttypes.h>
51-
#elif defined(WIN32)
51+
#elif defined(_WIN32)
5252
typedef unsigned __int32 uint32_t;
5353
#endif
5454
#endif
@@ -249,7 +249,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) {
249249
#endif
250250
pool = dict->strings;
251251
while (pool != NULL) {
252-
if (pool->end - pool->free > namelen)
252+
if ((size_t)(pool->end - pool->free) > namelen)
253253
goto found_pool;
254254
if (pool->size > size) size = pool->size;
255255
limit += pool->size;
@@ -317,7 +317,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen,
317317
#endif
318318
pool = dict->strings;
319319
while (pool != NULL) {
320-
if (pool->end - pool->free > namelen + plen + 1)
320+
if ((size_t)(pool->end - pool->free) > namelen + plen + 1)
321321
goto found_pool;
322322
if (pool->size > size) size = pool->size;
323323
limit += pool->size;
@@ -453,14 +453,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
453453
}
454454
switch (namelen) {
455455
case 10: value += name[9];
456+
/* Falls through. */
456457
case 9: value += name[8];
458+
/* Falls through. */
457459
case 8: value += name[7];
460+
/* Falls through. */
458461
case 7: value += name[6];
462+
/* Falls through. */
459463
case 6: value += name[5];
464+
/* Falls through. */
460465
case 5: value += name[4];
466+
/* Falls through. */
461467
case 4: value += name[3];
468+
/* Falls through. */
462469
case 3: value += name[2];
470+
/* Falls through. */
463471
case 2: value += name[1];
472+
/* Falls through. */
464473
default: break;
465474
}
466475
return(value);
@@ -496,15 +505,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
496505
}
497506
switch (plen) {
498507
case 10: value += prefix[9];
508+
/* Falls through. */
499509
case 9: value += prefix[8];
510+
/* Falls through. */
500511
case 8: value += prefix[7];
512+
/* Falls through. */
501513
case 7: value += prefix[6];
514+
/* Falls through. */
502515
case 6: value += prefix[5];
516+
/* Falls through. */
503517
case 5: value += prefix[4];
518+
/* Falls through. */
504519
case 4: value += prefix[3];
520+
/* Falls through. */
505521
case 3: value += prefix[2];
522+
/* Falls through. */
506523
case 2: value += prefix[1];
524+
/* Falls through. */
507525
case 1: value += prefix[0];
526+
/* Falls through. */
508527
default: break;
509528
}
510529
len -= plen;
@@ -514,15 +533,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
514533
}
515534
switch (len) {
516535
case 10: value += name[9];
536+
/* Falls through. */
517537
case 9: value += name[8];
538+
/* Falls through. */
518539
case 8: value += name[7];
540+
/* Falls through. */
519541
case 7: value += name[6];
542+
/* Falls through. */
520543
case 6: value += name[5];
544+
/* Falls through. */
521545
case 5: value += name[4];
546+
/* Falls through. */
522547
case 4: value += name[3];
548+
/* Falls through. */
523549
case 3: value += name[2];
550+
/* Falls through. */
524551
case 2: value += name[1];
552+
/* Falls through. */
525553
case 1: value += name[0];
554+
/* Falls through. */
526555
default: break;
527556
}
528557
return(value);

doc/Makefile.am

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ docs: web $(top_builddir)/NEWS libxml2.xsa $(man_MANS)
243243

244244
api: libxml2-api.xml libxml2-refs.xml $(APIPAGES) $(srcdir)/html/index.html $(WIN32_DIR)/libxml2.def.src ../elfgcchack.h $(srcdir)/site.xsl
245245

246-
web: $(PAGES)
246+
web: $(PAGES) xmllint.html xmlcatalog_man.html
247247

248248
../elfgcchack.h: $(srcdir)/elfgcchack.xsl $(srcdir)/libxml2-api.xml
249249
-@(if [ -x $(XSLTPROC) ] ; then \
@@ -314,9 +314,15 @@ libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.x
314314
xmllint.1: xmllint.xml
315315
-@($(XSLTPROC) --nonet xmllint.xml)
316316

317+
xmllint.html: xmllint.xml
318+
-@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl xmllint.xml)
319+
317320
xmlcatalog.1: xmlcatalog_man.xml
318321
-@($(XSLTPROC) --nonet xmlcatalog_man.xml)
319322

323+
xmlcatalog_man.html: xmlcatalog_man.xml
324+
-@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl xmlcatalog_man.xml)
325+
320326
check-extra-dist:
321327
for f in $(EXTRA_DIST_wc) ; do echo $$f; done | sort -u >tmp.EXTRA_DIST_wc
322328
for f in $(EXTRA_DIST) ; do echo $$f; done | sort >tmp.EXTRA_DIST

doc/elfgcchack.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifdef IN_LIBXML
1919
#ifdef __GNUC__
2020
#ifdef PIC
21-
#ifdef linux
21+
#ifdef __linux__
2222
#if (__GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
2323

2424
#include "libxml/c14n.h"

doc/libxml2.xsa

Lines changed: 15 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -8,125 +8,24 @@
88
</vendor>
99
<product id="libxml2">
1010
<name>libxml2</name>
11-
<version>v2.9.5</version>
12-
<last-release> Sep 04 2017</last-release>
11+
<version>v2.9.6</version>
12+
<last-release> Oct 06 2017</last-release>
1313
<info-url>http://xmlsoft.org/</info-url>
14-
<changes> - Security:
15-
Detect infinite recursion in parameter entities (Nick Wellnhofer),
16-
Fix handling of parameter-entity references (Nick Wellnhofer),
17-
Disallow namespace nodes in XPointer ranges (Nick Wellnhofer),
18-
Fix XPointer paths beginning with range-to (Nick Wellnhofer)
19-
20-
- Documentation:
21-
Documentation fixes (Nick Wellnhofer),
22-
Spelling and grammar fixes (Nick Wellnhofer)
23-
24-
- Portability:
25-
Adding README.zOS to list of extra files for the release (Daniel Veillard),
26-
Description of work needed to compile on zOS (Stéphane Michaut),
27-
Porting libxml2 on zOS encoding of code (Stéphane Michaut),
28-
small changes for OS/400 (Patrick Monnerat),
29-
relaxng.c, xmlschemas.c: Fix build on pre-C99 compilers (Chun-wei Fan)
14+
<changes> - Portability:
15+
Change preprocessor OS tests to __linux__ (Nick Wellnhofer)
3016

3117
- Bug Fixes:
32-
Problem resolving relative URIs (Daniel Veillard),
33-
Fix unwanted warnings when switching encodings (Nick Wellnhofer),
34-
Fix signature of xmlSchemaAugmentImportedIDC (Daniel Veillard),
35-
Heap-buffer-overflow read of size 1 in xmlFAParsePosCharGroup (David Kilzer),
36-
Fix NULL pointer deref in xmlFAParseCharClassEsc (Nick Wellnhofer),
37-
Fix infinite loops with push parser in recovery mode (Nick Wellnhofer),
38-
Send xmllint usage error to stderr (Nick Wellnhofer),
39-
Fix NULL deref in xmlParseExternalEntityPrivate (Nick Wellnhofer),
40-
Make sure not to call IS_BLANK_CH when parsing the DTD (Nick Wellnhofer),
41-
Fix xmlHaltParser (Nick Wellnhofer),
42-
Fix pathological performance when outputting charrefs (Nick Wellnhofer),
43-
Fix invalid-source-encoding warnings in testWriter.c (Nick Wellnhofer),
44-
Fix duplicate SAX callbacks for entity content (David Kilzer),
45-
Treat URIs with scheme as absolute in C14N (Nick Wellnhofer),
46-
Fix copy-paste errors in error messages (Nick Wellnhofer),
47-
Fix sanity check in htmlParseNameComplex (Nick Wellnhofer),
48-
Fix potential infinite loop in xmlStringLenDecodeEntities (Nick Wellnhofer),
49-
Reset parser input pointers on encoding failure (Nick Wellnhofer),
50-
Fix memory leak in xmlParseEntityDecl error path (Nick Wellnhofer),
51-
Fix xmlBuildRelativeURI for URIs starting with './' (Nick Wellnhofer),
52-
Fix type confusion in xmlValidateOneNamespace (Nick Wellnhofer),
53-
Fix memory leak in xmlStringLenGetNodeList (Nick Wellnhofer),
54-
Fix NULL pointer deref in xmlDumpElementContent (Daniel Veillard),
55-
Fix memory leak in xmlBufAttrSerializeTxtContent (Nick Wellnhofer),
56-
Stop parser on unsupported encodings (Nick Wellnhofer),
57-
Check for integer overflow in memory debug code (Nick Wellnhofer),
58-
Fix buffer size checks in xmlSnprintfElementContent (Nick Wellnhofer),
59-
Avoid reparsing in xmlParseStartTag2 (Nick Wellnhofer),
60-
Fix undefined behavior in xmlRegExecPushStringInternal (Nick Wellnhofer),
61-
Check XPath exponents for overflow (Nick Wellnhofer),
62-
Check for overflow in xmlXPathIsPositionalPredicate (Nick Wellnhofer),
63-
Fix spurious error message (Nick Wellnhofer),
64-
Fix memory leak in xmlCanonicPath (Nick Wellnhofer),
65-
Fix memory leak in xmlXPathCompareNodeSetValue (Nick Wellnhofer),
66-
Fix memory leak in pattern error path (Nick Wellnhofer),
67-
Fix memory leak in parser error path (Nick Wellnhofer),
68-
Fix memory leaks in XPointer error paths (Nick Wellnhofer),
69-
Fix memory leak in xmlXPathNodeSetMergeAndClear (Nick Wellnhofer),
70-
Fix memory leak in XPath filter optimizations (Nick Wellnhofer),
71-
Fix memory leaks in XPath error paths (Nick Wellnhofer),
72-
Do not leak the new CData node if adding fails (David Tardon),
73-
Prevent unwanted external entity reference (Neel Mehta),
74-
Increase buffer space for port in HTTP redirect support (Daniel Veillard),
75-
Fix more NULL pointer derefs in xpointer.c (Nick Wellnhofer),
76-
Avoid function/data pointer conversion in xpath.c (Nick Wellnhofer),
77-
Fix format string warnings (Nick Wellnhofer),
78-
Disallow namespace nodes in XPointer points (Nick Wellnhofer),
79-
Fix comparison with root node in xmlXPathCmpNodes (Nick Wellnhofer),
80-
Fix attribute decoding during XML schema validation (Alex Henrie),
81-
Fix NULL pointer deref in XPointer range-to (Nick Wellnhofer)
82-
83-
- Improvements:
84-
Updating the spec file to reflect Fedora 24 (Daniel Veillard),
85-
Add const in five places to move 1 KiB to .rdata (Bruce Dawson),
86-
Fix missing part of comment for function xmlXPathEvalExpression() (Daniel Veillard),
87-
Get rid of "blanks wrapper" for parameter entities (Nick Wellnhofer),
88-
Simplify handling of parameter entity references (Nick Wellnhofer),
89-
Deduplicate code in encoding.c (Nick Wellnhofer),
90-
Make HTML parser functions take const pointers (Nick Wellnhofer),
91-
Build test programs only when needed (Nick Wellnhofer),
92-
Fix doc/examples/index.py (Nick Wellnhofer),
93-
Fix compiler warnings in threads.c (Nick Wellnhofer),
94-
Fix empty-body warning in nanohttp.c (Nick Wellnhofer),
95-
Fix cast-align warnings (Nick Wellnhofer),
96-
Fix unused-parameter warnings (Nick Wellnhofer),
97-
Rework entity boundary checks (Nick Wellnhofer),
98-
Don't switch encoding for internal parameter entities (Nick Wellnhofer),
99-
Merge duplicate code paths handling PE references (Nick Wellnhofer),
100-
Test SAX2 callbacks with entity substitution (Nick Wellnhofer),
101-
Support catalog and threads tests under --without-sax1 (Nick Wellnhofer),
102-
Misc fixes for 'make tests' (Nick Wellnhofer),
103-
Initialize keepBlanks in HTML parser (Nick Wellnhofer),
104-
Add test cases for bug 758518 (David Kilzer),
105-
Fix compiler warning in htmlParseElementInternal (Nick Wellnhofer),
106-
Remove useless check in xmlParseAttributeListDecl (Nick Wellnhofer),
107-
Allow zero sized memory input buffers (Nick Wellnhofer),
108-
Add TODO comment in xmlSwitchEncoding (Nick Wellnhofer),
109-
Check for integer overflow in xmlXPathFormatNumber (Nick Wellnhofer),
110-
Make Travis print UBSan stacktraces (Nick Wellnhofer),
111-
Add .travis.yml (Nick Wellnhofer),
112-
Fix expected error output in Python tests (Nick Wellnhofer),
113-
Simplify control flow in xmlParseStartTag2 (Nick Wellnhofer),
114-
Disable LeakSanitizer when running API tests (Nick Wellnhofer),
115-
Avoid out-of-bound array access in API tests (Nick Wellnhofer),
116-
Avoid spurious UBSan errors in parser.c (Nick Wellnhofer),
117-
Parse small XPath numbers more accurately (Nick Wellnhofer),
118-
Rework XPath rounding functions (Nick Wellnhofer),
119-
Fix white space in test output (Nick Wellnhofer),
120-
Fix axis traversal from attribute and namespace nodes (Nick Wellnhofer),
121-
Check for trailing characters in XPath expressions earlier (Nick Wellnhofer),
122-
Rework final handling of XPath results (Nick Wellnhofer),
123-
Make xmlXPathEvalExpression call xmlXPathEval (Nick Wellnhofer),
124-
Remove unused variables (Nick Wellnhofer),
125-
Don't print generic error messages in XPath tests (Nick Wellnhofer)
126-
127-
- Cleanups:
128-
Fix a couple of misleading indentation errors (Daniel Veillard),
129-
Remove unnecessary calls to xmlPopInput (Nick Wellnhofer)
18+
Fix XPath stack frame logic (Nick Wellnhofer),
19+
Report undefined XPath variable error message (Nick Wellnhofer),
20+
Fix regression with librsvg (Nick Wellnhofer),
21+
Handle more invalid entity values in recovery mode (Nick Wellnhofer),
22+
Fix structured validation errors (Nick Wellnhofer),
23+
Fix memory leak in LZMA decompressor (Nick Wellnhofer),
24+
Set memory limit for LZMA decompression (Nick Wellnhofer),
25+
Handle illegal entity values in recovery mode (Nick Wellnhofer),
26+
Fix debug dump of streaming XPath expressions (Nick Wellnhofer),
27+
Fix memory leak in nanoftp (Nick Wellnhofer),
28+
Fix memory leaks in SAX1 parser (Nick Wellnhofer)
13029

13130

13231
</changes>

0 commit comments

Comments
 (0)