1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-13 20:58:16 +03:00

4656 Commits

Author SHA1 Message Date
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
Nick Wellnhofer
4dd6d7a58e Fix list callback signatures
Make sure that all parameters and return values of list callback
functions exactly match the callback function type. This is required
to pass clang's Control Flow Integrity checks and to allow compilation
to asm.js with Emscripten.

Also change the `user` parameter type from `const void *` to `void *`.
2017-11-09 17:28:00 +01:00
Nick Wellnhofer
e03f0a199a Fix hash callback signatures
Make sure that all parameters and return values of hash callback
functions exactly match the callback function type. This is required
to pass clang's Control Flow Integrity checks and to allow compilation
to asm.js with Emscripten.

Fixes bug 784861.
2017-11-09 16:42:47 +01:00
Nick Wellnhofer
71462a6006 Introduce xmlPosixStrdup and update xmlMemStrdup
Introduce xmlPosixStrdup, an internal strdup implementation matching the
POSIX strdup type signature, and update xmlMemStrdup to use it.

Thanks to Vlad Tsyrklevich for the initial patch.
2017-11-09 15:30:15 +01:00
Vlad Tsyrklevich
28f52fe89d Refactor name and type signature for xmlNop
Update xmlNop's name to xmlInputReadCallbackNop and its type signature
to match xmlInputReadCallback.

Fixes bug 786134.
2017-11-09 13:43:08 +01:00
Nick Wellnhofer
7218255092 Add test for ICU flush and pivot buffer 2017-11-04 15:38:58 +01:00
Joel Hockey
0b19f236a2 Fixed ICU to set flush correctly and provide pivot buffer.
By always setting flush=TRUE when doing multiple reads, ICU
will not correctly handle truncated utf8 chars across read
boundaries.

The fix is to set flush=TRUE only on final read, and to
provide a pivot buffer which is maintained by libxml
between calls to ucnv_convertEx.
2017-11-04 15:25:31 +01:00
Nick Wellnhofer
4b4135977e Skip EBCDIC tests if EBCDIC isn't supported
Fixes bug 603432.
2017-11-04 15:25:30 +01:00
Nick Wellnhofer
f404c4f500 Compile testapi with -Wno-unused-function 2017-11-04 15:03:20 +01:00
Daniel Veillard
bc5a5d6583 Release of libxnl2-2.9.7
* configure.ac doc/news.html : update for release
* doc/news.html doc/xmlcatalog.1 doc/xmlcatalog_man.html: regenerated
v2.9.7
2017-11-02 21:26:55 +01:00
Nick Wellnhofer
09f51ecbc5 Add Makefile rules to rebuild HTML man pages
This should make sure that the online version of the man pages for
xmllint and xmlcatalog stay up to date. Also rebuild both HTML
documents.
v2.9.7-rc1
2017-10-24 14:29:26 +02:00
Jan Pokorný
ca01f8133e xmlcatalog: refresh man page wrt. quering system catalog easily
Also normalize "lookup" spelling.
2017-10-24 13:57:43 +02:00
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