1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-03-07 06:40:22 +00:00
XML parser and toolkit
Find a file
Jan Alexander Steffens (heftig) fac4411aa6 catalog: Free xmlCatalogResolveCache on cleanup
Otherwise the `tstLastError.py` test will complain about a memory leak.

Fixes: b706c5c5b7 (Add xmlCatalogResolveCache)
Fixes: https://gitlab.gnome.org/GNOME/libxml2/-/issues/1069
2026-03-05 18:31:27 +01:00
.gitlab-ci CI: Remove not working ci jobs 2026-03-05 11:16:48 +01:00
codegen catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
doc fix to issue 227 adding xpath0 to xmllint 2025-12-11 11:25:04 -05:00
example tests: Make global variables static 2025-08-01 15:27:11 +02:00
fuzz Remove LZMA support 2025-09-08 15:30:53 +02:00
include threads: don't force _WIN32_WINNT to Vista if it's set to a higher value 2026-01-24 06:38:40 +00:00
m4 build: Remove version script 2025-03-04 16:54:41 +01:00
python Remove LZMA support 2025-09-08 15:30:53 +02:00
result fix: Prevent infinite recursion in xmlCatalogListXMLResolve 2026-01-04 16:01:55 +02:00
test Add xmlCatalogResolveCache 2026-02-17 11:28:43 +00:00
win32 Remove legacy win32 build system 2025-09-10 18:07:39 +02:00
xstc tests: Remove XSTC Python tests 2025-05-02 22:30:12 +02:00
.editorconfig cmake: Don't use tabs in CMakeLists.txt 2024-04-23 18:16:03 +02:00
.gitattributes Fix .gitattributes 2020-07-23 20:46:42 +02:00
.gitignore Add /build and /install directories to gitignore 2025-12-16 07:41:35 +01:00
.gitlab-ci.yml CI: Remove not working ci jobs 2026-03-05 11:16:48 +01:00
autogen.sh autotools: Fix pkg.m4 check 2024-06-24 20:37:39 +02:00
buf.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
c14n.c Fix C14N type confusion 2025-12-10 11:20:53 +00:00
catalog.c catalog: Free xmlCatalogResolveCache on cleanup 2026-03-05 18:31:27 +01:00
chvalid.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
CMakeLists.txt testcatalog: Add new tests for catalog.c 2026-01-21 13:29:08 +00:00
config.h.cmake.in http: Remove built-in HTTP client 2025-04-20 18:21:06 +02:00
configure.ac build: compile option WINPATH to allow processing Windows path on other platforms 2026-01-14 07:38:48 +00:00
Copyright Mention contributors in Copyright 2025-01-29 13:11:38 +01:00
debugXML.c debug: Remove obsolete handling of special case 2025-06-23 22:59:31 +02:00
dict.c Revert "dict: Rework reference counting" 2025-09-08 14:59:24 +02:00
encoding.c fuzz: Make fuzzy encoding match more lenient 2025-10-13 22:58:38 +02:00
entities.c entities: Deprecate internal DTD-related functions 2025-06-03 00:13:26 +02:00
error.c parser: Split out xmlParserInputGetWindow 2025-07-31 14:23:23 +02:00
globals.c Revert "globals: Don't export DllMain on Windows" 2025-09-29 10:50:00 +02:00
hash.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
HTMLparser.c parser: Remove xmlHaltParser 2025-07-31 14:23:23 +02:00
HTMLtree.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
libxml-2.0.pc.in build: Set Cflags.private on Windows 2024-06-21 13:51:09 +02:00
libxml.h Use __has_attribute to check for __counted_by__ support 2025-02-06 10:17:09 +01:00
libxml.m4 build: Stop installing libxml.m4 2024-06-15 20:14:03 +02:00
libxml2-config.cmake.cmake.in Remove LZMA support 2025-09-08 15:30:53 +02:00
libxml2-config.cmake.in Remove LZMA support 2025-09-08 15:30:53 +02:00
libxml2.doap Add email to danigm maintainer entry 2025-12-10 07:32:52 +01:00
lintmain.c fuzz: Remove hacks to build lint fuzzer 2025-01-17 20:06:45 +01:00
list.c include: Stop using *Ptr typedefs in public headers 2025-05-16 18:03:12 +02:00
MAINTAINERS.md Document process to remove API functions in MAINTAINERS.md 2025-10-07 12:00:51 +02:00
Makefile.am testcatalog: Add new tests for catalog.c 2026-01-21 13:29:08 +00:00
meson.build meson: remove hardcoded buildtype=debug default 2026-03-01 20:44:16 +01:00
meson_options.txt build: compile option WINPATH to allow processing Windows path on other platforms 2026-01-14 07:38:48 +00:00
nanohttp.c doc: Move brief to top, params to bottom of doc comments 2025-05-06 19:51:38 +02:00
NEWS Release v2.15.0 2025-09-15 13:34:13 +02:00
parser.c parser: Fix infinite loop in xmlCtxtParseContent 2026-01-07 12:25:19 +00:00
parserInternals.c parser: Make sure to stop parser before checking max errors 2025-08-03 18:26:29 +02:00
pattern.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
README.md build: compile option WINPATH to allow processing Windows path on other platforms 2026-01-14 07:38:48 +00:00
README.zOS Large batch of typo fixes 2019-09-30 18:04:38 +02:00
relaxng.c use duplicating variant in relaxng to mitigate UAF 2026-02-10 14:24:15 -07:00
run_and_diff.cmake Add tests that relied on POSIX shell script to native CMake. 2025-12-12 11:11:11 +00:00
runsuite.c relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation 2025-08-18 10:18:41 +00:00
runtest.c Add RelaxNG include limit 2026-01-14 09:47:23 +00:00
runxmlconf.c tests: Make global variables static 2025-08-01 15:27:11 +02:00
SAX2.c valid: Don't add ids when validating entity content 2025-08-23 14:59:55 +02:00
schematron.c schematron: fix additional memory leaks on error paths 2026-02-26 10:36:28 +00:00
shell.c shell: free cmdline before continue 2025-12-10 12:21:16 +00:00
test_xmlcatalog_add_del.cmake Add tests that relied on POSIX shell script to native CMake. 2025-12-12 11:11:11 +00:00
testapi.c catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
testcatalog.c testcatalog: Add new tests for catalog.c 2026-01-21 13:29:08 +00:00
testchar.c tests: Make global variables static 2025-08-01 15:27:11 +02:00
testdict.c tests: Fix sanitizer version check on old Apple clang 2024-11-13 20:22:32 +01:00
testdso.c warning patches from Peter Breitenlohner serious DTD parsing speedups, 2005-01-25 00:22:52 +00:00
testlimits.c testlimits: optionally accept '-timeout' input 2026-01-12 09:21:54 -05:00
testModule.c doc: Remove email addresses from documentation 2025-05-01 23:23:42 +02:00
testparser.c Revert "uri: Handle \'s in path for xmlParseURI" 2026-02-17 12:17:24 +01:00
testrecurse.c tests: Always use xmlMalloc/xmlFree 2025-05-25 22:47:34 +02:00
threads.c Revert "dict: Rework reference counting" 2025-09-08 14:59:24 +02:00
timsort.h xpath: Hide internal sort functions 2024-10-19 14:53:25 +02:00
tree.c Fix xmlRemoveEntity removing from wrong hash table 2026-02-09 12:57:25 -05:00
uri.c uri: fix signed integer overflow in xmlBuildRelativeURISafe 2026-02-20 20:00:35 +08:00
valid.c valid: Undeprecate xmlValidGetPotentialChildren 2025-09-26 16:29:10 +02:00
VERSION Bump version to 2.16.0 2025-09-15 13:57:30 +02:00
xinclude.c doc: Stop using *Ptr typedefs in documentation 2025-05-16 18:03:12 +02:00
xlink.c doc: Stop using *Ptr typedefs in documentation 2025-05-16 18:03:12 +02:00
xml2-config-meson meson: Install a xml2-config script 2025-03-13 18:36:32 +01:00
xml2-config.in build: Fix XML_LIBDIR usage 2024-06-21 13:48:22 +02:00
xmlcatalog.c catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
xmlIO.c xmlIO: use size_t for buffer size reallocation 2026-02-19 20:52:40 +01:00
xmllint.c fix to issue 227 adding xpath0 to xmllint 2025-12-11 11:25:04 -05:00
xmlmemory.c doc: Small fixes 2025-06-03 00:17:03 +02:00
xmlmodule.c doc: Misc fixes 2025-06-03 01:27:12 +02:00
xmlreader.c reader: Remove unused member xinclude_name 2025-06-23 22:59:31 +02:00
xmlregexp.c relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation 2025-08-18 10:18:41 +00:00
xmlsave.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
xmlschemas.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
xmlschemastypes.c xmlschemastypes: ensure thread safe global initialization 2025-06-26 17:46:01 +01:00
xmlstring.c xmlstring: fix access out-of-bound array if len <= 0 2025-12-12 10:56:44 +00:00
xmlwriter.c fix memory leak in issue 1054 2026-02-11 22:32:12 +00:00
xpath.c Ignore next/prev of documents when traversing XPath 2026-01-14 07:14:04 +00:00
xpointer.c doc: Misc fixes to xpointer 2025-06-03 00:59:00 +02:00

libxml2

libxml2 is an XML toolkit implemented in C, originally developed for the GNOME Project.

Official releases can be downloaded from https://download.gnome.org/sources/libxml2/

The git repository is hosted on GNOME's GitLab server: https://gitlab.gnome.org/GNOME/libxml2

Bugs should be reported at https://gitlab.gnome.org/GNOME/libxml2/-/issues.

Documentation is available at https://gitlab.gnome.org/GNOME/libxml2/-/wikis

License

This code is released under the MIT License, see the Copyright file.

Security

This is open-source software written by hobbyists and maintained by volunteers.

It's NOT recommended to use this software to process untrusted data. There is a lot of ways that a malicious crafted xml could exploit a hidden vulnerability in the software.

The software is provided "as is", without warranty of any kind, express or implied. Use this software at your own risk.

To report security bugs, you can create a confidential issue with the "security" label. We will review and work on it as a best effort. But remember that this is a community project, maintained by volunteer developers, so if you are concern about any important security bug that's critical for you, feel free to collaborate and provide a patch.

The main rule is to be kind. Do not pressure developers to fix a CVE or to work on a functionality that you need, because that won't work. This is a community project, developers will work in the issues that they consider interesting and when they want. All contributions are welcome, so if something is important for you, you can always get involved, implement it yourself and be part of the open source community.

Build instructions

libxml2 can be built with GNU Autotools, CMake or meson.

Autotools (for POSIX systems like Linux, BSD, macOS)

If you build from a Git tree, you have to install Autotools and start by generating the configuration files with:

./autogen.sh [configuration options]

If you build from a source tarball, extract the archive with:

tar xf libxml2-xxx.tar.gz
cd libxml2-xxx

Then you can configure and build the library:

./configure [configuration options]
make

The following options disable or enable code modules and relevant symbols:

--with-c14n             Canonical XML 1.0 support (on)
--with-catalog          XML Catalogs support (on)
--with-debug            debugging module (on)
--with-docs             Build documentation (off)
--with-history          history support for xmllint shell (off)
--with-readline[=DIR]   use readline in DIR for shell (off)
--with-html             HTML parser (on)
--with-http             ABI compatibility for removed HTTP support (off)
--with-iconv[=DIR]      iconv support (on)
--with-icu              ICU support (off)
--with-iso8859x         ISO-8859-X support if no iconv (on)
--with-modules          dynamic modules support (on)
--with-output           serialization support (on)
--with-pattern          xmlPattern selection interface (on)
--with-push             push parser interfaces (on)
--with-python           Python bindings (off)
--with-reader           xmlReader parsing interface (on)
--with-regexps          regular expressions support (on)
--with-relaxng          RELAX NG support (on)
--with-sax1             older SAX1 interface (on)
--with-schemas          XML Schemas 1.0 support (on)
--with-schematron       Schematron support (off)
--with-threads          multithreading support (on)
--with-thread-alloc     per-thread malloc hooks (off)
--with-valid            DTD validation support (on)
--with-winpath          Windows path support (on for Windows)
--with-writer           xmlWriter serialization interface (on)
--with-xinclude         XInclude 1.0 support (on)
--with-xpath            XPath 1.0 support (on)
--with-xptr             XPointer support (on)
--with-zlib[=DIR]       use libz in DIR (off)

Other options:

--prefix=DIR            set installation prefix
--with-minimum          build a minimally sized library (off)
--with-legacy           maximum ABI compatibility (off)

Note that by default, no optimization options are used. You have to enable them manually, for example with:

CFLAGS='-O2 -fno-semantic-interposition' ./configure

Now you can run the test suite with:

make check

Please report test failures to the bug tracker.

Then you can install the library:

make install

At that point you may have to rerun ldconfig or a similar utility to update your list of installed shared libs.

CMake (mainly for Windows)

Example commands:

cmake -E tar xf libxml2-xxx.tar.xz
cmake -S libxml2-xxx -B builddir [options]
cmake --build builddir
ctest --test-dir builddir
cmake --install builddir

Common CMake options include:

-D BUILD_SHARED_LIBS=OFF            # build static libraries
-D CMAKE_BUILD_TYPE=Release         # specify build type (single-config)
--config Release                    # specify build type (multi-config)
-D CMAKE_INSTALL_PREFIX=/usr/local  # specify the install path
-D LIBXML2_WITH_ICONV=OFF           # disable iconv
-D LIBXML2_WITH_ZLIB=ON             # enable zlib

You can also open the libxml source directory with its CMakeLists.txt directly in various IDEs such as CLion, QtCreator, or Visual Studio.

Meson

Example commands:

meson setup [options] builddir
ninja -C builddir
meson test -C builddir
ninja -C builddir install

See the meson_options.txt file for options. For example:

-Dprefix=$prefix
-Dhistory=enabled
-Dschemas=disabled
-Dzlib=enabled

Dependencies

libxml2 supports POSIX and Windows operating systems.

The iconv function is required for conversion of character encodings. This function is part of POSIX.1-2001. If your platform doesn't provide iconv, you need an external libiconv library, for example GNU libiconv. Using ICU is also supported but discouraged.

The xmllint executable uses libreadline and libhistory if enabled.

Build requirements

Besides build system tools, only a C compiler should be required. Reconfiguration of the Autotools build requires the pkg.m4 macro from pkg-config. Building the documentation requires Doxygen, xsltproc and the DocBook 4 XSLT stylesheets. Building the Python bindings requires Doxygen.

Contributing

The current version of the code can be found in GNOME's GitLab at https://gitlab.gnome.org/GNOME/libxml2. The best way to get involved is by creating issues and merge requests on GitLab.

All code must conform to C89 and pass the GitLab CI tests. Add regression tests if possible.

Authors

  • Daniel Veillard
  • Bjorn Reese
  • William Brack
  • Igor Zlatkovic for the Windows port
  • Aleksey Sanin
  • Nick Wellnhofer