1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00
Commit Graph

332 Commits

Author SHA1 Message Date
Nick Wellnhofer
f404c4f500 Compile testapi with -Wno-unused-function 2017-11-04 15:03:20 +01:00
Daniel Veillard
56ec9cef9e Adding README.zOS to list of extra files for the release 2017-08-28 20:15:38 +02:00
Nick Wellnhofer
988a5a3b6b Build test programs only when needed
Add test programs to 'check_PROGRAMS' instead of 'noinst_PROGRAMS'.

Fixes bug 760457.
2017-06-17 15:44:50 +02:00
Nick Wellnhofer
dbaab1f369 Test SAX2 callbacks with entity substitution
This detects regressions like bug 760367.
2017-06-16 21:38:57 +02:00
Nick Wellnhofer
67f9f9d6c8 Misc fixes for 'make tests'
- Silence test output.
- Clean up after doc/examples tests.
- Adjust expected output for script tests.
- Add missing results for relaxng/pattern3

There are still two test failures I can't comment on:

- regexp/bug316338
- schemas/any4_0
2017-06-12 19:46:56 +02:00
Nick Wellnhofer
e26630548e Fix handling of parameter-entity references
There were two bugs where parameter-entity references could lead to an
unexpected change of the input buffer in xmlParseNameComplex and
xmlDictLookup being called with an invalid pointer.

Percent sign in DTD Names
=========================

The NEXTL macro used to call xmlParserHandlePEReference. When parsing
"complex" names inside the DTD, this could result in entity expansion
which created a new input buffer. The fix is to simply remove the call
to xmlParserHandlePEReference from the NEXTL macro. This is safe because
no users of the macro require expansion of parameter entities.

- xmlParseNameComplex
- xmlParseNCNameComplex
- xmlParseNmtoken

The percent sign is not allowed in names, which are grammatical tokens.

- xmlParseEntityValue

Parameter-entity references in entity values are expanded but this
happens in a separate step in this function.

- xmlParseSystemLiteral

Parameter-entity references are ignored in the system literal.

- xmlParseAttValueComplex
- xmlParseCharDataComplex
- xmlParseCommentComplex
- xmlParsePI
- xmlParseCDSect

Parameter-entity references are ignored outside the DTD.

- xmlLoadEntityContent

This function is only called from xmlStringLenDecodeEntities and
entities are replaced in a separate step immediately after the function
call.

This bug could also be triggered with an internal subset and double
entity expansion.

This fixes bug 766956 initially reported by Wei Lei and independently by
Chromium's ClusterFuzz, Hanno Böck, and Marco Grassi. Thanks to everyone
involved.

xmlParseNameComplex with XML_PARSE_OLD10
========================================

When parsing Names inside an expanded parameter entity with the
XML_PARSE_OLD10 option, xmlParseNameComplex would call xmlGROW via the
GROW macro if the input buffer was exhausted. At the end of the
parameter entity's replacement text, this function would then call
xmlPopInput which invalidated the input buffer.

There should be no need to invoke GROW in this situation because the
buffer is grown periodically every XML_PARSER_CHUNK_SIZE characters and,
at least for UTF-8, in xmlCurrentChar. This also matches the code path
executed when XML_PARSE_OLD10 is not set.

This fixes bugs 781205 (CVE-2017-9049) and 781361 (CVE-2017-9050).
Thanks to Marcel Böhme and Thuan Pham for the report.

Additional hardening
====================

A separate check was added in xmlParseNameComplex to validate the
buffer size.
2017-06-05 18:38:33 +02:00
Nick Wellnhofer
ac9a4560ee Disable LeakSanitizer when running API tests
The autogenerated API tests leak memory.
2017-06-01 14:31:28 +02:00
Nick Wellnhofer
43f50f4dfc Fix white space in test output
Quote echoed variable to avoid newlines being converted to space.
2017-05-31 15:30:19 +02:00
Daniel Veillard
9b4b8cb3e2 Add a make rule to rebuild for ASAN 2016-05-04 12:33:32 +08:00
orzen
0f84ee239f Add autogen.sh to distrib
For https://bugzilla.gnome.org/show_bug.cgi?id=761782

autogen.sh was not included in the tarball releases which complicates
situations when users have to make changes to e.g. configure.ac andi
have to re-generate configure.
2016-02-09 17:55:40 +01:00
Samuel Martin
fa23ac1a79 Provide cmake module
* add libxml2-config.cmake.in template
* configure.ac: add libxml2-config.cmake.in to the configured file list
* Makefile.am: install libxml2-config.cmake under ${libdir}/cmake/libxml2

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
2014-10-13 18:02:53 +08:00
Patrick Monnerat
917e353f2b OS400: include in distribution tarball. 2014-10-04 21:13:48 +08:00
Daniel Veillard
742a0bbbcc Keep libxml2.syms when running "make distclean" 2012-09-11 13:37:30 +08:00
Arfrever Frehtes Taifersar Arahesis
1f01f49ba6 Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors
For https://bugzilla.gnome.org/show_bug.cgi?id=677606
For https://bugs.gentoo.org/show_bug.cgi?id=417539

If libxml2-2.8.0 is built with --with-icu --with-python on a system that has an
older version of libxml2 installed, then during "make install", libxml2mod.so
gets relinked to the systemwide version of libxml2.so.2 instead of libxml2.so.2
from the build tree, and fails at runtime if symbol versions from the older
libxml2.so.2 are not available. This effectively makes it impossible to build a
libxml2-2.8.0 binary package on a system that does not already have
libxml2-2.8.0 installed.

Investigation by Rafał Mużyło and Arfrever Frehtes Taifersar Arahesis revealed
the cause of the problem to be that libxml2's configure was adding ICU_LIBS to
LDFLAGS instead of to LIBADD. This resulted in GNU libtool using the wrong
argument order in its relinking command that gets run during "make install".
2012-08-28 22:16:50 +08:00
Akira TAGOH
961b535c10 Bug 676544 - fails to build with --without-sax1
Added some ifdef'd LIBXML_SAX1_ENABLED to make it buildable with
--without-sax1 configure option.
2012-08-28 22:03:16 +08:00
Vojtech Fried
3e031b7dae Switching XPath node sorting to Timsort
I use libxml xpath engine on quite large (and mostly "flat") xml files.
It seems that Shellsort, that is used in xmlXPathNodeSetSort is a
performance bottleneck for my case. I have read some posts about sorting
in libxml in the libxml archive, but I agree that qsort was not the way
to go. I experimented with Timsort instead and my results were good for
me. For about 10000 nodes, my test was about 5x faster with Timsort,
for 1000 nodes about 10% faster, for small data files, the difference
was not measurable.
* timsort.h: the algorithm, kept in a separate header
* xpath.c: plug in the new algorithm in xmlXPathNodeSetSort
* Makefile.am: add the header to the EXTRA_DIST
* doc/apibuild.py: avoid indexing the new header
2012-08-24 16:52:44 +08:00
Daniel Veillard
73f94c602c Small cleanup for valgrind target 2012-08-24 16:38:54 +08:00
Daniel Richard G
ec4fc529b3 More updates and cleanups on autotools and Makefiles
Makefile.am, example/Makefile.am:

* Replaced the obsolete INCLUDES variable with AM_CPPFLAGS/AM_CFLAGS

acinclude.m4:

* autoupdate replaced AC_FD_CC with AS_MESSAGE_LOG_FD

autogen.sh:

* Added -Wall to the autoreconf invocation, which turned up a whole slew
   of warnings that are fixed by this patch

configure.in:

* Most of the changes are due to autoupdate, with subsequent manual
   tidying

* Note that autoupdate bumped the AC_PREREQ version from 2.59 to 2.68. If
   you normally use an older version of Autoconf, and everything works fine
   if you comment out that directive, feel free to bump down the version
   accordingly.

* Ensure that #include directives in C fragments always have no whitespace
   to the left of the '#' mark, as some preprocessors need that to be in
   the first column

example/Makefile.am:

* Don't need DEPS

* Use plain LDADD instead of LDADDS; if all programs in this file need to
   link against the same set of libraries, then this is all you need
2012-08-17 10:04:30 +08:00
Daniel Richard G
5706b6d876 Various "make distcheck" and portability fixups
Makefile.am:

* Don't use @VAR@, use $(VAR). Autoconf's AC_SUBST provides us the Make
   variable, it allows overriding the value at the command line, and
   (notably) it avoids a Make parse error in the libxml2_la_LDFLAGS
   assignment when @MODULE_PLATFORM_LIBS@ is empty

* Changed how the THREADS_W32 mechanism switches the build between
   testThreads.c and testThreadsWin32.c as appropriate; using AM_CONDITIONAL
   allows this to work cleanly and plays well with dependencies

* testapi.c should be specified as BUILT_SOURCES

* Create symlinks to the test/ and result/ subdirs so that the runtests
   target is usable in out-of-source-tree builds

* Don't do MAKEFLAGS+=--silent as this is not portable to non-GNU Makes

* Fixed incorrect find(1) syntax in the "cleanup" rule, and doing "rm -f"
   instead of just "rm" is good form

* (DIST)CLEANFILES needed a bit more coverage to allow "make distcheck" to
   pass

configure.in:

* Need AC_PROG_LN_S to create test/ and result/ symlinks in Makefile.am

* AC_LIBTOOL_WIN32_DLL and AM_PROG_LIBTOOL are obsolete; these have been
   superceded by LT_INIT

* Don't rebuild docs by default, as this requires GNU Make (as
   implemented)

* Check for uint32_t as some platforms don't provide it

* Check for some more functions, and undefine HAVE_MMAP if we don't also
   HAVE_MUNMAP (one system I tested on actually needed this)

* Changed THREADS_W32 from a filename insert into an Automake conditional

* The "Copyright" file will not be in the current directory if builddir !=
   srcdir

doc/Makefile.am:

* EXTRA_DIST cannot use wildcards when they refer to generated files; this
   breaks dependencies. What I did was define EXTRA_DIST_wc, which uses GNU
   Make $(wildcard) directives to build up a list of files, and EXTRA_DIST,
   as a literal expansion of EXTRA_DIST_wc. I also added a new rule,
   "check-extra-dist", to simplify checking that the two variables are
   equivalent. (Note that this works only when builddir == srcdir)

   (I can implement this differently if desired; this is just one way of
   doing it)

* Don't define an "all" target; this steps on Automake's toes

* Fixed up the "libxml2-api.xml ..." rule by using $(wildcard) for
   dependencies (as Make doesn't process the wildcards otherwise) and
   qualifying appropriate files with $(srcdir)

   (Note that $(srcdir) is not needed in the dependencies, thanks to VPATH,
   which we can count on as this is GNU-Make-only code anyway)

doc/devhelp/Makefile.am:

* Qualified appropriate files with $(srcdir)

* Added an "uninstall-local" rule so that "make distcheck" passes

doc/examples/Makefile.am:

* Rather than use a wildcard that doesn't work, use a substitution that
   most Make programs can handle

doc/examples/index.py:

* Do the same here

include/libxml/nanoftp.h:

* Some platforms (e.g. MSVC 6) already #define INVALID_SOCKET:

     user@host:/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/\
     Include$ grep -R INVALID_SOCKET .
     ./WINSOCK.H:#define INVALID_SOCKET  (SOCKET)(~0)
     ./WINSOCK2.H:#define INVALID_SOCKET  (SOCKET)(~0)

include/libxml/xmlversion.h.in:

* Support ancient GCCs (I was actually able to build the library with 2.5
   but for this bit)

python/Makefile.am:

* Expanded CLEANFILES to allow "make distcheck" to pass

python/tests/Makefile.am:

* Define CLEANFILES instead of a "clean" rule, and added tmp.xml to allow
   "make distcheck" to pass

testRelax.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H (as some
   systems have the header but not the function)

testSchemas.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H

testapi.c:

* Don't use putenv() if it's not available

threads.c:

* This fixes the following build error on Solaris 8:

     libtool: compile:  cc -DHAVE_CONFIG_H -I. -I./include -I./include \
     -D_REENTRANT -D__EXTENSIONS__ -D_REENTRANT -Dsparc -Xa -mt -v \
     -xarch=v9 -xcrossfile -xO5 -c threads.c  -KPIC -DPIC -o threads.o
     "threads.c", line 442: controlling expressions must have scalar type
     "threads.c", line 512: controlling expressions must have scalar type
     cc: acomp failed for threads.c
     *** Error code 1

trio.c:

* Define isascii() if the system doesn't provide it

trio.h:

* The trio library's HAVE_CONFIG_H header is not the same as LibXML2's
   HAVE_CONFIG_H header; this change is needed to avoid a double-inclusion

win32/configure.js:

* Added support for the LZMA compression option

win32/Makefile.{bcb,mingw,msvc}:

* Added appropriate bits to support WITH_LZMA=1

* Install the header files under $(INCPREFIX)\libxml2\libxml instead of
   $(INCPREFIX)\libxml, to mirror the install location on Unix+Autotools

xml2-config.in:

* @MODULE_PLATFORM_LIBS@ (usually "-ldl") needs to be in there in order for
   `xml2-config --libs` to provide a complete set of dependencies

xmllint.c:

* Use HAVE_MMAP instead of the less-explicit HAVE_SYS_MMAN_H
2012-08-06 11:32:54 +08:00
Daniel Veillard
187e52901b Fix make dist to include new private header files 2012-08-06 10:27:58 +08:00
Daniel Veillard
0de1f3114a first version of testlimits new test
Used to check behaviour on various parsing limits
2012-07-23 14:24:28 +08:00
Daniel Veillard
bca22f40c3 Adding a new buf module for buffers
This also add converter functions between xmlBuf and xmlBuffer
* buf.c buf.h: the old xmlBuffer routines but modified for size_t
  and using xmlBuf instead of xmlBuffer
* Makefile.am: add the 2 new files
* include/libxml/xmlerror.h: add an entry for the new module
* include/libxml/tree.h: expose the xmlBufPtr type but not the
  structure which stay private
2012-07-23 14:24:26 +08:00
Daniel Veillard
c943f708f1 Release of libxml2-2.8.0
- Makefile.am: don't package .git
- configure.in : update to new release
- doc/xml.html: added the new release
- doc/* testapi.c: regenerated
2012-05-23 17:10:59 +08:00
Daniel Veillard
48f0f3f29f Fix "make tst" to grab lzma lib too 2012-05-08 10:59:41 +08:00
Daniel Veillard
adf5ec9496 Cleanups of lzma support
- fix inclusion of the separated file
- use namespaced name for the 4 non-static routines
- add padding after external structures included in-situ
- add new requirement to spec file
- general cleanup of code
2012-01-27 22:19:53 +08:00
Anders F Bjorklund
0755b66266 included xzlib in dist 2012-01-27 22:19:53 +08:00
Anders F Bjorklund
eae5261779 add lzma compression support 2012-01-27 22:19:52 +08:00
Adrian Bunk
64b0d60c28 Switch from the obsolete mkinstalldirs to AC_PROG_MKDIR_P
This was obsoleted in 2005 so we should be safe.
But keep AC_PREREQ to 2.59 as it's still widely deployed.
2010-11-04 09:43:31 +01:00
Roumen Petrov
120a269976 Fix build with mingw
- include/libxml/xmlexports.h: restore export decoration otherwise
  xsltproc and xmlsec crash
- libxml.h: define LIBXML_STATIC for static build
- configure.in: enable modules support for mingw* builds
- Makefile.am: flags for testdso if modules support enabled
2010-03-10 10:07:49 +01:00
Daniel Veillard
3157e51508 Upgrade some of the configure and autogen
Based on Roumen Petrov suggestions
2010-03-09 11:32:46 +01:00
Daniel Veillard
ec18c96008 558452 fight with reg test and error report
* relaxng.c: tiny fix and provide more context on some errors
* result/relaxng/558452_0* test/relaxng/558452*: add some regression
  tests for the bugs
* Makefile.am runtest.c: fight with the fact streaming error messages
  can differ due to missing node context
2009-08-26 18:37:43 +02:00
Daniel Veillard
2173b5cb30 555833 always use rm -f in uninstall-local
* Makefile.am: so that make clean doesn't fail in some circumstances
2009-08-24 14:23:32 +02:00
Daniel Veillard
b0641a10a6 584605 package VxWorks folder in the distribution
* Makefile.am: as Igor Novoseltsev pointed out this is missing from
  the distro
2009-08-24 10:15:13 +02:00
Daniel Veillard
8ed1072c2d Add symbol versioning to libxml2 shared libs
* libxml2.syms: the symbols with history, going back to 2.4.30
* Makefile.am configure.in: linking flags detection and use
* parser.c tree.c valid.c xpointer.c: various cleanup of functions
  which could be made static or simply discarded, not that many
2009-08-20 19:17:36 +02:00
Aleksey Sanin
838682478c Aleksey Sanin support for c14n 1.1
* c14n.c include/libxml/c14n.h: adds support for C14N 1.1,
  new flags at the API level
* runtest.c Makefile.am testC14N.c xmllint.c: add support in CLI
  tools and test binaries
* result/c14n/1-1-without-comments/* test/c14n/1-1-without-comments/*:
  add a new batch of tests
2009-07-09 10:26:22 +02:00
Daniel Veillard
da3fee406d Borland C fix from Moritz Both regenerate, workaround a problem for buffer
* trionan.c: Borland C fix from Moritz Both
* testapi.c: regenerate, workaround a problem for buffer testing
* xmlIO.c HTMLtree.c: new internal entry point to hide even better
  xmlAllocOutputBufferInternal
* tree.c: harden the code around buffer allocation schemes
* parser.c: restore the warning when namespace names are not absolute
  URIs
* runxmlconf.c: continue regression tests if we get the expected
  number of errors
* Makefile.am: run the python tests on make check
* xmlsave.c: handle the HTML documents and trees
* python/libxml.c: convert python serialization to the xmlSave APIs
  and avoid some horrible hacks
Daniel

svn path=/trunk/; revision=3790
2008-09-01 13:08:57 +00:00
Daniel Veillard
4cc67bb77e patch from Robert Schwebel , allows to compile the example if configured
* doc/examples/reader3.c: patch from  Robert Schwebel , allows to
  compile the example if configured without output support fixes
  #545582
* Makefile.am: add testrecurse to the make check tests
* HTMLparser.c: if the parser got a encoding argument it should be
  used over what the meta specifies, patch fixing #536346
Daniel

svn path=/trunk/; revision=3785
2008-08-29 19:58:23 +00:00
Daniel Veillard
0161e638c6 completely different fix for the recursion detection based on entity
* parser.c include/libxml/parser.h: completely different fix for
  the recursion detection based on entity density, big cleanups
  in the entity parsing code too
* result/*.sax*: the parser should not ask for used defined versions
  of the predefined entities
* testrecurse.c: automatic test for entity recursion checks
* Makefile.am: added testrecurse
* test/recurse/lol* test/recurse/good*: a first set of tests for
  the recursion
Daniel

svn path=/trunk/; revision=3783
2008-08-28 15:36:32 +00:00
Daniel Veillard
bfa5cf1ce7 add an --with-coverage configure option and a 'make cov' target based on
* configure.in Makefile.am: add an --with-coverage configure option
  and a 'make cov' target based on gcc profiling and the lcov
  tool. Currently at 68.9% coverage out of 'make check' and 
  runsuite executions.
* xmlreader.c: remove warnings due to C++ comments
Daniel

svn path=/trunk/; revision=3780
2008-08-27 15:33:28 +00:00
Daniel Veillard
bf9c1dad3a add the testchar to 'make check' Volker Grabsch pointed out a typo
* Makefile.am: add the testchar to 'make check'
* xmlschemas.c: Volker Grabsch pointed out a typo
* xmlregexp.c: production [19] from XML Schemas regexps were a
  mistake removed in version REC-xmlschema-2-20041028, Volker Grabsch
  provided a patch to remove it
* test/schemas/regexp-char-ref_0.xml test/schemas/regexp-char-ref_0.xsd
  test/schemas/regexp-char-ref_1.xsd result/schemas/regexp-char-ref_0_0
  result/schemas/regexp-char-ref_1_0: Volker Grabsch also provided
  regession tests for this
Daniel

svn path=/trunk/; revision=3776
2008-08-26 07:46:42 +00:00
Daniel Veillard
0765ae898b adding a check-valgrind target Daniel
* makefile.am: adding a check-valgrind target
Daniel

svn path=/trunk/; revision=3770
2008-08-08 12:14:37 +00:00
Daniel Veillard
d330f18fbc add the new test in 'make check' and update it to check subdictionaries
* Makefile.am testdict.c: add the new test in 'make check' and
  update it to check subdictionaries processing.
Daniel

svn path=/trunk/; revision=3769
2008-08-08 12:03:22 +00:00
Daniel Veillard
d7af555327 rewrite the URI parser to update to rfc3986 (from 2396) removed the error
* uri.c include/libxml/uri.h: rewrite the URI parser to update to
  rfc3986 (from 2396)
* test/errors/webdav.xml result/errors/webdav.xml*: removed the
  error test, 'DAV:' is a correct URI under 3986
* Makefile.am: small cleanup in make check
Daniel

svn path=/trunk/; revision=3763
2008-08-04 15:29:44 +00:00
Daniel Veillard
373345764b added a skipped list, insert rmt-ns10-035 improve 'make check' clean up
* runxmlconf.c: added a skipped list, insert rmt-ns10-035
* Makefile.am: improve 'make check'
* include/libxml/xmlerror.h parser.c: clean up namespace errors
  checking and reporting, errors when a document is labelled
  as UTF-16 while it is parsed as UTF-8 and no encoding was given
  explicitely.
* result/errors/webdav.xml.*: some warnings are no recategorized
  as Namespace errors
Daniel

svn path=/trunk/; revision=3761
2008-07-31 08:20:02 +00:00
Daniel Veillard
051d52cb61 fix a bug not detecting cross entity comments probably when comment
* parser.c: fix a bug not detecting cross entity comments probably
  when comment parsing got optimized.
* Makefile.am: add make check
* runxmlconf.c: fix the log file name
Daniel

svn path=/trunk/; revision=3758
2008-07-29 16:44:59 +00:00
Daniel Veillard
7e5c3f481f add a C program to run the W3C test suite, work in progress add a new
* runxmlconf.c Makefile.am: add a C program to run the W3C test
  suite, work in progress
* xmllint.c: add a new option --oldxml10 to use the old parser
* parser.c: fix the XML_PARSE_OLD10 processing of the new option
  and a bug in version parsing
Daniel

svn path=/trunk/; revision=3757
2008-07-29 16:12:31 +00:00
Daniel Veillard
34e3f64191 implement XML-1.0 5th edition, add parser option XML_PARSE_OLD10 to stick
* include/libxml/parser.h include/libxml/xmlerror.h parser.c:
  implement XML-1.0 5th edition, add parser option XML_PARSE_OLD10
  to stick to old behaviour
* testapi.c gentest.py: modified slightly and regenerated
* Makefile.am: add testchar
Daniel

svn path=/trunk/; revision=3755
2008-07-29 09:02:27 +00:00
Daniel Veillard
33fe28885c extend the cleanup rule space cleanup Daniel
* Makefile.am: extend the cleanup rule
* xmlschemas.c: space cleanup
Daniel

svn path=/trunk/; revision=3737
2008-04-10 08:09:25 +00:00
Daniel Veillard
9ebb632238 patches from John Carr to start cleaning up 'make diskcheck' problems c.f.
* check-relaxng-test-suite2.py check-relaxng-test-suite.py
  Makefile.am python/tests/Makefile.am python/Makefile.am
  check-xsddata-test-suite.py: patches from John Carr to
  start cleaning up 'make diskcheck' problems c.f. #506228
Daniel

svn path=/trunk/; revision=3674
2008-01-11 07:19:24 +00:00
Daniel Veillard
cb4284e296 applied patch from Richard Jones to for the silent flag on valgrind when
* xstc/Makefile.am doc/examples/Makefile.am Makefile.am: applied
  patch from Richard Jones to for the silent flag on valgrind
  when doing "make valgrind"
* xmlregexp.c: raise a regexp error when '\' is misused to escape
  a standard character.
Daniel

svn path=/trunk/; revision=3606
2007-04-25 13:55:20 +00:00