1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-15 23:24:06 +03:00

4668 Commits

Author SHA1 Message Date
Jan Pokorný
6b780f65d8 xmlcatalog: restore ability to query system catalog easily
I've noticed that easy way of locating a DocBook XSLT in a configure
script of another project doesn't work anymore.  It is using something
like: xmlcatalog "" ${DOCBOOK_XSL_URI}/${DOCBOOK_XSL_PATH}.  The script
is then forced to a plain, suboptimal search using find utility.
Indeed, I retrospectively realize that the check was working just
by mere accident given that the window this presumably side-effect
was applicable had not lasted long, some 8 months between

  054c716ea1bf001544127a4ab4f4346d1b9947e7

introducing xmlInitializeCatalog in the LIBXML_TEST_VERSION-rooted
call chain, and

  f65128f38289d77ff322d63aef2858cc0a819c34

reverting that again.

So while one can state /etc/xml/catalog constant explicitly, in
some use cases (such as the mentioned one -- that's why I wanted
to omit stating the full path in the first place), this is rather
an implementation detail, perhaps subject to change from that POV.
Therefore I propose to restore that behaviour in the targeted
manner without global disruptions this time around.

As a side-effect, this fixes indenting of the affected part.
2017-10-21 15:26:40 +02:00
Nick Wellnhofer
5e986e3b33 Fix mixed decls and code in timsort.h 2017-10-21 15:09:33 +02:00
Nick Wellnhofer
cfa912dd91 Fix deprecated Travis compiler flag 2017-10-21 15:02:30 +02:00
Nick Wellnhofer
cf820462b7 Rework handling of return values in thread tests
Pass a struct to each thread that contains the filename and the return
value. This avoids casting a DWORD to a pointer on Windows.
2017-10-21 14:52:35 +02:00
J. Peter Mugaas
f05af837bb Add declaration for DllMain
Fixes a compiler warning.
2017-10-21 14:51:35 +02:00
J. Peter Mugaas
882a165a3f Fix preprocessor conditional in threads.h
Make sure that the preprocessor conditions and types for xmlDllMain
match exactly in threads.h and threads.c.
2017-10-21 14:50:44 +02:00
Nick Wellnhofer
154824ee5e Fix unused variable warnings in testrecurse 2017-10-21 14:10:11 +02:00
J. Peter Mugaas
a4864c2f98 Fix pointer comparison warnings on 64-bit Windows 2017-10-21 14:01:10 +02:00
J. Peter Mugaas
8bc6c878e9 Fix macro redefinition warning 2017-10-21 13:57:44 +02:00
J. Peter Mugaas
d2c329a9a4 Fix -Wimplicit-fallthrough warnings
Add "falls through" comments to quench implicit-fallthrough warnings
which are enabled by -Wextra under GCC 7.
2017-10-21 13:49:31 +02:00
Nick Wellnhofer
bec3c17fae Upgrade timsort.h to latest revision
Upgrade timsort.h to revision 05fd77bfec049ce8b7c408c4d3dd2d51ee061a15
from https://github.com/swenson/sort

Removed all code unrelated to Timsort and made minor adjustments for
cross-platform compatibility.
2017-10-12 15:22:21 +02:00
Nick Wellnhofer
25499fc229 Increase warning level to /W3 under MSVC
With the exception of timsort.h and warnings 4244 and 4267, the MSVC
build is now warnings-free with /W3.
2017-10-09 16:52:34 +02:00
Nick Wellnhofer
6472dfe337 Fix a couple of warnings in dict.c and threads.c
Only visible on Windows.
2017-10-09 16:52:15 +02:00
Nick Wellnhofer
8575c1170b Default to native threads on MinGW-w64 2017-10-09 16:52:14 +02:00
Nick Wellnhofer
5672397477 Simplify Windows IO functions
Remove "native" non-Unicode functions which were only needed for
pre-NT systems like Windows 95/98.

Don't redefine `stat` but use `struct _stat` and `_stat()` instead.
2017-10-09 16:52:14 +02:00
Nick Wellnhofer
d1505ef57a Update .gitignore for Windows 2017-10-09 14:35:56 +02:00
Nick Wellnhofer
82e0394d46 Fix runtest on Windows
Unbuffer the output and fix some compiler warnings.
2017-10-09 14:35:56 +02:00
Nick Wellnhofer
ecbdfa9eb3 Fix unused variable warnings in nanohttp.c
Some variables are only used if certain macros are set. Move the
declarations around.
2017-10-09 14:35:55 +02:00
Nick Wellnhofer
e3890546d7 Fix the Windows header mess
Don't include windows.h and wsockcompat.h from config.h but only when
needed.

Don't define _WINSOCKAPI_ manually. This was apparently done to stop
windows.h from including winsock.h which is a problem if winsock2.h
wasn't included first. But on MinGW, this causes compiler warnings.
Define WIN32_LEAN_AND_MEAN instead which has the same effect.

Always use the compiler-defined _WIN32 macro instead of WIN32.
2017-10-09 14:35:40 +02:00
Nick Wellnhofer
bee8f1e47b Don't include winsock2.h in xmllint.c
I'm not sure why xmllint.c did include winsock2.h at all. Stop
including the header as both MinGW and MSVC builds don't seem to
require it.
2017-10-09 13:59:44 +02:00
Nick Wellnhofer
45b0ebdc8d socklen_t is always int on Windows
Define XML_SOCKLEN_T as `int` unconditionally in wsockcompat.h. Fixes
compiler warnings and removes some duplicated code.
2017-10-09 13:57:42 +02:00
Nick Wellnhofer
5b2324b6e0 Don't redefine socket error codes on Windows
Translate WSA error codes instead of blindly redefining POSIX error
codes on Windows. The redefinitions caused warnings in modern Windows
environments, but simply ifdef'ing out the redefinitions seems like
the wrong approach.
2017-10-09 13:49:36 +02:00
Nick Wellnhofer
d422b954be Fix pointer/int cast warnings on 64-bit Windows
On 64-bit Windows, `long` is 32 bits wide and can't hold a pointer.
Switch to ptrdiff_t instead which should be the same size as a pointer
on every somewhat sane platform without requiring C99 types like
intptr_t.

Fixes bug 788312.

Thanks to J. Peter Mugaas for the report and initial patch.
2017-10-09 13:47:49 +02:00
Nick Wellnhofer
41c0a13fe7 Fix Windows compiler warnings in xmlCanonicPath
The code handling Windows paths assigned some char/xmlChar pointers
without explicit casts. Also remove an unused variable.
2017-10-09 13:46:44 +02:00
Nick Wellnhofer
5af594d8bc Fix comparison of nodesets to strings
Fix two bugs in xmlXPathNodeValHash which could lead to errors when
comparing nodesets to strings:

- Only use contents of text nodes to compute the hash for element nodes.
  Comments, PIs, and other node types don't affect the string-value and
  must be ignored.
- Reset `string` to NULL for node types other than text.

Reported by Aleksei on the mailing list:

    https://mail.gnome.org/archives/xml/2017-September/msg00016.html
2017-10-07 15:22:57 +02:00
Nick Wellnhofer
0c91391683 Remove generated file python/setup.py from version control 2017-10-07 15:22:57 +02:00
Nick Wellnhofer
03a238f954 Use __linux__ macro in generated code 2017-10-07 15:22:57 +02:00
Daniel Veillard
4b4d3d8516 Release of libxml2-2.9.6
* configure.ac doc/xml.html doc/news.html: updated for release
v2.9.6
2017-10-06 09:00:53 +02:00
Nick Wellnhofer
0f3b843b35 Fix XPath stack frame logic
Move the calls to xmlXPathSetFrame and xmlXPathPopFrame around in
xmlXPathCompOpEvalPositionalPredicate to make sure that the context
object on the stack is actually protected. Otherwise, memory corruption
can occur when calling sloppily coded XPath extension functions.

Fixes bug 783160.
v2.9.6-rc1
2017-09-21 17:55:39 +02:00
Nick Wellnhofer
3157cf4e53 Report undefined XPath variable error message
Commit c851970 removed a redundant error message if XPath evaluation
failed. This uncovered a case where an undefined XPath variable error
wasn't reported correctly.

Thanks to Petr Pisar for the report.

Fixes bug 787941.
2017-09-20 16:13:29 +02:00
Nick Wellnhofer
b90d8989d3 Fix regression with librsvg
Instead of using xmlCreateIOParserCtxt, librsvg pushes its own
xmlParserInput on top of a memory push parser. This incorrect use of
the API confuses several parser checks and, since 2.9.5, completely
breaks documents with internal subsets. Work around the problem with
internal subsets.

Thanks to Petr Sumbera for the report:

    https://mail.gnome.org/archives/xml/2017-September/msg00011.html

Also see

    https://bugzilla.gnome.org/show_bug.cgi?id=787895
2017-09-19 16:45:49 +02:00
Nick Wellnhofer
2cdaaab11c Change preprocessor OS tests to __linux__
"linux" without leading underscores is deprecated and less reliable.
2017-09-14 21:30:51 +02:00
Nick Wellnhofer
abbda93c72 Handle more invalid entity values in recovery mode
In attribute content, don't emit entity references if there are
problems with the entity value. Otherwise some illegal entity values
like

    <!ENTITY a '&#38;#x123456789;'>

would later cause problems like integer overflow.

Make xmlStringLenDecodeEntities return NULL on more error conditions
including invalid char refs and errors from recursive calls. Remove
some fragile error checks based on lastError that shouldn't be
needed now. Clear the entity content in xmlParseAttValueComplex if
an error was found.

Found by OSS-Fuzz. Should fix bug 783052.

Also see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3343
2017-09-13 17:21:04 +02:00
Nick Wellnhofer
c709f3f267 Fix structured validation errors
Also pass 'str2'. Fixes bug 777473.
2017-09-07 19:52:39 +02:00
Nick Wellnhofer
07e227ed00 Fix memory leak in LZMA decompressor 2017-09-07 19:08:43 +02:00
Nick Wellnhofer
e2a9122b8d Set memory limit for LZMA decompression
Otherwise malicious LZMA compressed files could consume large amounts
of memory when decompressed.

According to the xz man page, files compressed with `xz -9` currently
require 65 MB to decompress, so set the limit to 100 MB.

Should fix bug 786696.
2017-09-07 19:08:43 +02:00
Nick Wellnhofer
0fcab658a2 Handle illegal entity values in recovery mode
Make xmlParseEntityValue always return NULL on error. Otherwise some
illegal entity values like

    <!ENTITY e '&%#4294967298;'>

would later cause problems like integer overflow.

Found by OSS-Fuzz. Should fix bug 783052.

Also see

    https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=592
    https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2732
2017-09-07 19:08:43 +02:00
Nick Wellnhofer
ca8635bfc2 Fix debug dump of streaming XPath expressions
The debug function xmlXPathDebugDumpCompExpr would crash when
called with a "streaming" expression.

Fixes bug 787368.
2017-09-07 15:46:12 +02:00
Nick Wellnhofer
3b3d75028a Fix memory leak in nanoftp
Found by OSS-Fuzz (testcase 5487741645094912). Free the user and
password strings in xmlNanoFTPFreeCtxt.

Also see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2727
2017-09-06 02:11:48 +02:00
Nick Wellnhofer
83fb4119a9 Fix memory leaks in SAX1 parser
Found by OSS-Fuzz. I could only reproduce this with the (obsolete)
SAX1 parser.

One leak is caused by duplicate namespaced attribute names and can be
reproduced in memory mode (testcase 4556417027538944):

    $ cat file
    <d xmlns:a="ns" a:x="v" xmlns:b="ns" b:x="v"/>
    $ xmllint --sax1 --memory file

The other is caused by ATTLISTs with a normalized default for "xmlns"
if they're processed after the entity recursion limit was hit
(testcase 5580750034305024).

    $ cat file
    <!DOCTYPE d [
	<!ENTITY a '<d>&a;'>
	<!ATTLIST d xmlns NMTOKEN 't'>
    ]>
    <d>&a;
    $ xmllint --sax1 --valid file

Also see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2461
2017-09-06 01:12:34 +02:00
Daniel Veillard
2960178fe8 Release of libxml2-2.9.5
* configure.ac, doc/xslt.html: updated for the release
* doc/*, python/setup.py, testapi.c: regenerated
v2.9.5
2017-09-04 15:38:47 +02:00
Nick Wellnhofer
69936b129f Revert "Print error messages for truncated UTF-8 sequences"
This reverts commit 79c8a6b which caused a serious regression in
streaming mode.

Also reverts part of commit 52ceced "Fix infinite loops with push
parser in recovery mode".

Fixes bug 786554.
v2.9.5-rc2
2017-08-30 14:19:06 +02:00
Daniel Veillard
e29e50e54f Updating the spec file to reflect Fedora 24
new python subpackages namings
v2.9.5-rc1
2017-08-29 12:40:54 +02:00
Bruce Dawson
8f57103793 Add const in five places to move 1 KiB to .rdata
xmlUnicodeBlocks is logically const but was not marked as such. This
fixes that, thus moving it to the read-only data segment.
2017-08-28 21:27:03 +02:00
Daniel Veillard
3daee3f159 Problem resolving relative URIs
Raised by Matthias Pigulla <mp@webfactory.de>

In a nutshell we had that bug on URI composition after some fixes in
the area of localhost empty shortcuts :

./testURI --base file:///some/where file

Without patch: file:/some/file
With patch: file:///some/file
2017-08-28 21:12:14 +02:00
Daniel Veillard
f19385a589 Fix a couple of misleading indentation errors
Raised by gcc as potential error, no semantic change needed but
fixed the indentation
2017-08-28 20:40:19 +02:00
Daniel Veillard
dbb828feb9 Fix missing part of comment for function xmlXPathEvalExpression() 2017-08-28 20:38:53 +02:00
Daniel Veillard
56ec9cef9e Adding README.zOS to list of extra files for the release 2017-08-28 20:15:38 +02:00
Daniel Veillard
afb0f93c12 Revert "Allow build on Visual Studio 2017 community edition for WIN32 on a 64 bit machine."
This reverts commit 605899cf22d185f537eb5efb97a55be30467eb17.
2017-08-28 17:45:47 +02:00
Boris Shtrasman
605899cf22 Allow build on Visual Studio 2017 community edition for WIN32 on a 64 bit machine.
This patch hold the necessary changes to build libxml2 with Visual
Studio 2017 for WIN32 on a 64 bit machine.

Today 64 bit windows installation are very common, and Visual Studio
2017 community is the most recent version i have access to.

I have chosen 32 bit and SDK 8.1 to be as close as possible to Igor Zlatkovic work.
2017-08-28 14:58:21 +02:00