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

4679 Commits

Author SHA1 Message Date
Felix Bünemann
d2ef114c6b Fix xmlTextReaderNext with preparsed document
This fixes the traversal of parent nodes using xmlTextReaderNext()
when the reader is based on a preparsed document (created using
xmlReaderWalker(doc)).

Without this fix the parser will abort even though there are parent
nodes it should traverse to, if it is not currently on an element or
attribute node. This is incorrect, since it can be for example on a
text node when it needs to enter backtracking.
2018-09-01 14:31:34 +02:00
Michael Haubenwallner
c65c9e8ee0 Really declare dllexport/dllimport for Cygwin
Cygwin does not define _WIN32, but still requires dllexport/dllimport
tags for when applications use the --disable-auto-import linker flag,
probably set by the gl_WOE32_DLL autoconf macro in woe32-dll.m4 file.
2018-08-31 11:42:14 +02:00
Nick Wellnhofer
33d7ca53af Merge branch 'patch-2' into 'master'
Change dir to $THEDIR after ACLOCAL_PATH check

See merge request GNOME/libxml2!6
2018-08-24 10:10:02 +00:00
Vitaly Buka
19f5efd677 Change dir to $THEDIR after ACLOCAL_PATH check
autoreconf creates aclocal.m4 in $srcdir
2018-08-23 20:42:23 +00:00
Nick Wellnhofer
b6ab8b449c Improve error message if pkg.m4 couldn't be found
Check whether aclocal.m4 contains the pkg.m4 macro package after running
autoreconf and print a more helpful error message.

Thanks to 林博仁 (Buo-ren Lin) for the initial patch.

Closes: #21
2018-08-19 19:31:19 +02:00
林博仁(Buo-ren Lin)
173ea684dd Don't instruct user to run make when autogen.sh failed
Currently the autogen script will always tell user to run make even
when the configure script failed, this patch changes the behavior to
only show this message when the configure script terminates without
error.
2018-08-19 19:02:12 +02:00
Nick Wellnhofer
2240fbf591 Fix infinite loop in LZMA decompression
Check the liblzma error code more thoroughly to avoid infinite loops.

Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/13
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=794914

This is CVE-2018-9251 and CVE-2018-14567.

Thanks to Dongliang Mu and Simon Wörner for the reports.
2018-07-30 14:35:17 +02:00
Nick Wellnhofer
a436374994 Fix nullptr deref with XPath logic ops
If the XPath stack is corrupted, for example by a misbehaving extension
function, the "and" and "or" XPath operators could dereference NULL
pointers. Check that the XPath stack isn't empty and optimize the
logic operators slightly.

Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/5

Also see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901817
https://bugzilla.redhat.com/show_bug.cgi?id=1595985

This is CVE-2018-14404.

Thanks to Guy Inbar for the report.
2018-07-30 12:54:38 +02:00
Nick Wellnhofer
b7c50b8dde Remove stray character from comment
Fixes bug #795316:

https://bugzilla.gnome.org/show_bug.cgi?id=795316
2018-07-30 12:40:59 +02:00
Andrey Bienkowski
d2293cdbc8 Remove a misleading line from xmlCharEncOutput
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=793028

It seams this line was accidentally copied over from xmlCharEncOutFunc.
In xmlCharEncOutput output is a pointer so incrementing it by ret can
point it where it wasn't supposed to be pointing. Luckily the current
implementation doesn't dereference the pointer after advancing it.

Signed-off-by: Daniel Veillard <veillard@redhat.com>
2018-07-23 10:21:38 +08:00
Daniel Veillard
35e8348850 HTML noscript should not close p
For https://bugzilla.gnome.org/show_bug.cgi?id=795343

- HTMLparser.c: noscript should not close <p> but it should close <script>
2018-04-18 16:04:27 +02:00
Nick Wellnhofer
e61c82175e Run Travis ASan tests with "sudo: required"
See https://github.com/travis-ci/travis-ci/issues/9033
2018-04-16 20:46:13 +02:00
Nick Wellnhofer
fa33bf317a Improve restoring of context size and position
Restore context size and position where it is modified, not in
seemingly random places.
2018-04-16 20:23:48 +02:00
Nick Wellnhofer
665df41dcc Simplify and harden nodeset filtering
If a nodeset to be filtered is empty, it can be returned without popping
it from the stack.

Make sure to restore the context node in all error paths and never set
it to NULL.

Save and restore the context node in RANGETO operations.
2018-04-16 19:45:37 +02:00
Nick Wellnhofer
029d0e960c Avoid unnecessary backups of the context node 2018-04-16 18:28:42 +02:00
Nick Wellnhofer
938835e763 Don't change context node in xmlXPathRoot 2018-04-16 18:28:42 +02:00
Nick Wellnhofer
e22a83b1d0 Stop using XPATH_OP_RESET
It only sets the context node to NULL which doesn't seem useful and can
even cause bugs like bug #795299:

https://bugzilla.gnome.org/show_bug.cgi?id=795299
2018-04-16 18:20:43 +02:00
Nick Wellnhofer
ebe12882ee Fix inconsistency in xmlXPathIsInf
We don't use HUGE_VAL for INFINITY after the most recent fix.
2018-04-16 18:18:11 +02:00
Nick Wellnhofer
7a1bd7f649 Revert "Change calls to xmlCharEncInput to set flush false"
This reverts commit 6e6ae5daa6cd9640c9a83c1070896273e9b30d14 which
broke decoding of larger documents with ICU.

See https://bugs.chromium.org/p/chromium/issues/detail?id=820163
2018-03-17 00:03:24 +01:00
Nick Wellnhofer
7abec67147 NaN and Inf fixes for pre-C99 compilers
On some pre-C99 compilers, the NAN and INFINITY macros don't expand to
constant expressions.

Some MSVC versions complain about floating point division by zero in
constants.

Thanks to Fabrice Manfroi for the report.
2018-03-16 15:09:42 +01:00
Daniel Veillard
18890f471c Release of libxml2-2.9.8
* configure.ac doc/* libxml2.syms testapi.c: updated for the new release
v2.9.8
2018-03-05 17:09:43 +01:00
Patrick Welche
d910e99c32 python: remove single use of _PyVerify_fd
_PyVerify_fd disappeared from python with:

  https://hg.python.org/cpython/rev/e88e2049b793

https://bugzilla.gnome.org/show_bug.cgi?id=776815
2018-03-05 16:29:58 +01:00
Nick Wellnhofer
707ad080e6 Fix xmlParserEntityCheck
A previous commit removed the check for XML_ERR_ENTITY_LOOP which is
required to abort early in case of excessive entity recursion.
2018-01-23 16:37:54 +01:00
Nick Wellnhofer
ab362ab0ad Halt parser in case of encoding error
Should fix crbug.com/793715, although I wasn't able to reproduce the
issue.
v2.9.8-rc1
2018-01-22 15:42:26 +01:00
Nick Wellnhofer
60dded12cb Clear entity content in case of errors
This only affects recovery mode and avoids integer overflow in
xmlStringGetNodeList and possibly other nasty surprises.

See bug 783052 and

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3874
https://bugs.chromium.org/p/chromium/issues/detail?id=796804
2018-01-22 15:23:22 +01:00
Joel Hockey
6e6ae5daa6 Change calls to xmlCharEncInput to set flush false when not final call. Having flush incorrectly set to true causes errors for ICU. 2018-01-08 19:57:53 +01:00
Nick Wellnhofer
1637d612d1 Disable pointer-overflow UBSan checks under Travis
clang 5 added UBSan checks for pointer overflow which are triggered by
an API test.
2018-01-08 19:19:42 +01:00
Nick Wellnhofer
132af1a0d1 Fix buffer over-read in xmlParseNCNameComplex
Calling GROW can halt the parser if the buffer grows too large. This
will set the buffer to an empty string. Return immediately in this case,
otherwise the "current" pointer is advanced leading to a buffer over-read.

Found with OSS-Fuzz. See

https://oss-fuzz.com/testcase?key=6683819592646656
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5031
2018-01-08 18:48:01 +01:00
Daniel Veillard
ad88b54f1a Improve handling of context input_id
For https://bugzilla.gnome.org/show_bug.cgi?id=772726
This was used in xmlsec to detect issues with accessing external entities
and prevent them, but was unreliable, based on a patch from Aleksey Sanin

* parser.c: make sure input_id is incremented when creating sub-entities
            for parsing or when parsing out of context
2017-12-08 09:42:31 +01:00
Nick Wellnhofer
8ac759a6e6 Build more test executables on Windows/MSVC
Build all test executables required by 'make checktests'.
2017-11-27 18:26:32 +01:00
Nick Wellnhofer
706926fddf Fix ICU library filenames on Windows/MSVC
Fixes bug 790119.
2017-11-27 18:26:24 +01:00
ccpaging
d404919870 Add resource file to Windows DLL
Add a resource file containing verison information for the Windows DLL.
This is only used by the MSVC build for now.
2017-11-27 16:33:00 +01:00
Nick Wellnhofer
790c230fcf Run Travis tests with -Werror 2017-11-27 14:35:29 +01:00
Nick Wellnhofer
45efd0b05b Build with "-Wall -Wextra"
Remove warning options that are enabled with "-Wall -Wextra".

Disable -Warray-bounds warning that produces a (seemingly) false
positive in xpath.c.
2017-11-27 14:35:29 +01:00
Nick Wellnhofer
2677fbf4a4 Fix -Wtautological-pointer-compare warnings
Skip tautological pointer comparisons on pthread systems where we don't
use the weak symbols hack.
2017-11-27 14:35:29 +01:00
Nick Wellnhofer
ff628d46a1 Stop including ansidecl.h
This seems to be an undocumented, internal GCC header added a long time
ago. I don't know why it was included, but I think it can be safely
removed.
2017-11-27 14:35:29 +01:00
Nick Wellnhofer
bf3b456350 Remove unused AC_CHECKs 2017-11-27 14:35:29 +01:00
Nick Wellnhofer
cb5541c9f3 Fix libz and liblzma detection
If libz or liblzma are detected with pkg-config, AC_CHECK_HEADERS must
not be run because the correct CPPFLAGS aren't set. It is actually not
required have separate checks for LIBXML_ZLIB_ENABLED and HAVE_ZLIB_H.
Only check for LIBXML_ZLIB_ENABLED and remove HAVE_ZLIB_H macro.

Fixes bug 764657, bug 787041.
2017-11-27 14:33:37 +01:00
Nick Wellnhofer
ddbb075b70 Fix xmlXPathIsNaN broken by recent commit 2017-11-27 14:33:26 +01:00
Nick Wellnhofer
c1002101f7 Update information about contributing
The contents of the HACKING file were hopelessly outdated. Remove the
file and start with a CONTRIBUTING document.
2017-11-27 13:42:30 +01:00
Nick Wellnhofer
b21895717d Fix -Wenum-compare warnings
Also fixes a serious bug in xmlXPtrNewRangeNodePoint.
2017-11-27 13:42:30 +01:00
Nick Wellnhofer
359e750482 Fix -Wmisleading-indentation warnings 2017-11-27 13:42:30 +01:00
Nick Wellnhofer
8cb8e31773 Don't touch CFLAGS in configure.ac
CFLAGS shouldn't be touched by configure.ac. The variable is supplied by
the user and must come after other flags, so flags like warning options
can be overridden.

Rename CFLAGS to EXTRA_CFLAGS and add the value to AM_CFLAGS. This also
makes it possible to override flags for each Automake program or library.
2017-11-14 16:03:36 +01:00
Nick Wellnhofer
00859f9118 Fix callback signature in testapi.c 2017-11-14 16:03:31 +01:00
Nick Wellnhofer
13acadbb1c Ignore function pointer cast warnings
Use GCC pragmas as these warnings are enabled by -Wpedantic and there's
no way to disable them selectively.
2017-11-14 16:01:48 +01:00
Nick Wellnhofer
8813f397f8 Simplify XPath NaN, inf and -0 handling
Use C99 macros NAN, INFINITY, isnan, isinf. If they're not available:

- Assume that (0.0 / 0.0) generates a NaN and !(x == x) tests for NaN.
- Use C89's HUGE_VAL for INFINITY.

Remove manual handling of NaN, infinity and negative zero in functions
xmlXPathValueFlipSign and xmlXPathDivValues.

Remove xmlXPathGetSign. All the tests for negative zero can be replaced
with a test for negative or positive zero.

Simplify xmlXPathRoundFunction.

Remove Trio dependency.

This should work on IEEE 754 compliant implementations even if the C99
macros aren't available, but will likely break some ancient platforms.
If problems arise, my plan is to port the relevant trionan.c solution
to xpath.c. Note that non-compliant implementations are impossible
to fully support, anyway, since XPath requires IEEE 754.
2017-11-14 15:58:40 +01:00
Nick Wellnhofer
861823902b Revert "Compile testapi with -Wno-unused-function"
This reverts commit f404c4f500a0ec18b04463581d5d1b3aae7f7730.

The change broke non-GCC compilers.
2017-11-14 15:58:01 +01:00
Nick Wellnhofer
772c06487b Fix unused parameter warning without ICU 2017-11-09 17:56:31 +01:00
Nick Wellnhofer
86615e43bb Fix IO callback signatures 2017-11-09 17:47:47 +01:00
Nick Wellnhofer
e5f33e56ba Fix misc callback signatures
Fix parameter and return types for xmlC14NIsVisibleCallback and
xmlRegExecCallbacks.
2017-11-09 17:29:22 +01:00