1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-01-26 21:41:34 +03:00
Commit Graph

7728 Commits

Author SHA1 Message Date
Iván Chavero
84b8530d85 Fix xmlOutputBufferGetContent output when encoder is set.
The xmlOutputBufferGetContent function only returns the buffer attribute
of the _xmlOutputBuffer struct.
When the `encoder` attribute is set the content is stored in the `conv`
attribute after conversions are performed and the `buffer` attribute is
emptied. This causes the xmlOutputBufferGetContent to always return
empty when the `encoder` is set.

This patch fixes the function by returning the `conv` attribute when the
encoder is set.

Fixes: #991
2025-12-22 09:51:22 +01:00
Daniel Garcia Moreno
3b2d4638ec Add /build and /install directories to gitignore 2025-12-16 07:41:35 +01:00
Peter Fordham
cee7107a1b writer: Add a few extra NULL checks to avoid memory leaks on corrupt writer path. 2025-12-15 11:48:41 -08:00
Peter Fordham
aef94414c6 Initialize pointer incase we end up skipping the while loop completely. 2025-12-14 21:09:21 -08:00
Niels Dossche
98194640b8 Fix memory leak of prefix in xmlTextWriterStartElementNS() 2025-12-12 14:26:11 -06:00
Michal Privoznik
bcaae46a31 meson: Add valgrind test setup
Similarly to libtools, add a test setup to meson so that tests
can be run under valgrind even with meson:

  meson test -C $builddir --setup valgrind

Since meson has a timeout for individual tests (30 seconds) and
valgrind makes everything run slower, the timeout needs to be
increased (factor of 4 looks good enough).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2025-12-12 12:24:40 +00:00
Michal Privoznik
e2f7674871 autotools: Make valgrind actually check for leaks
Problem with libtools is that it produces shell scripts which
then set LD_LIBRARY_PATH and execute actual binary (hidden in
.libs dir). Therefore, running 'valgring ./testbinary' doesn't do
anything useful (beside checking for memleaks in shell). We want
to use `libtool --mode=execute valgrind ./testbinary`.

With that fixed, next step is to make valgrind return a non-zero
value if a memleak is detected (--error-exitcode=). And to show
individual memleaks let's use --leak-check=full.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2025-12-12 12:24:40 +00:00
Peter Fordham
6555048b24 Add tests that relied on POSIX shell script to native CMake. 2025-12-12 11:11:11 +00:00
Herman Semenoff
68f91d1893 xmlstring: fix access out-of-bound array if len <= 0 2025-12-12 10:56:44 +00:00
gabriel desharnais
c6167cf3b9 fix to issue 227 adding xpath0 to xmllint 2025-12-11 11:25:04 -05:00
Nick Wellnhofer
a30a4e6efc xmllint: Use zlib directly for output 2025-12-11 09:25:47 +00:00
Nick Wellnhofer
956dfd2ddd xmllint: Use zlib directly
This prepares xmllint for eventually removing decompression support from
libxml2.
2025-12-11 09:25:47 +00:00
Daniel Garcia Moreno
0704f52ea4 readme: Write a more possitive Security section
This patch changes the security section in the README.md file to give
more information.

This removes the "unmaintained" text, as this project is maintained
again. It also makes it clear that this is a community project, so
anyone will know what to expect, and it also makes explicit that
developers are volunteers and will work on the issues that they want, as
a try to avoid pressure from bug reporters.

The message try to be possitive, promoting collaboration instead of
conflict. The idea is to make it clear that collaboration is welcome and
the way to go is to do it yourself instead of asking the maintainers to
do it for you.
2025-12-10 09:51:48 -06:00
Daniel Garcia Moreno
160c8a43ba shell: free cmdline before continue
This patch frees the cmdline when it's not empty but it doesn't contain
any actual character.

If the cmdline is just whitespaces or \r and \n, the loop continues
without freeing the cmdline string, so it's a leak.

Fix https://gitlab.gnome.org/GNOME/libxml2/-/issues/1009
2025-12-10 12:21:16 +00:00
Peter Fordham
76a6ba4c41 Add specific check to avoid signed integer overflow of buffer size. 2025-12-10 12:14:08 +00:00
Benjamin Gilbert
b20dfb007d meson: Fix build with Meson < 1.3
Meson before 1.3 didn't support comma-separated lists in c_std.  Just
require c11 in that case.
2025-12-10 11:49:37 +00:00
Daniel Garcia Moreno
8c5e54d5bd Fix C14N type confusion
Do not try to get nsDef with xmlDoc

Fix https://gitlab.gnome.org/GNOME/libxml2/-/issues/1016
2025-12-10 11:20:53 +00:00
Daniel Garcia Moreno
05b0c03006 Fix nokogiri tests
Use the required specific bundler and add --disable-xml2-legacy
2025-12-10 12:13:32 +01:00
Daniel Garcia Moreno
b4bc4f73fe Add email to danigm maintainer entry 2025-12-10 07:32:52 +01:00
Iván Chavero
214fb81422 Adding ichavero and danigm as maintainers
Fixes: #1023
2025-12-09 23:42:40 -06:00
Nick Wellnhofer
9c80a89af2 Remove myself as maintainer
I got the following error message after trying to remove my maintainer
entry from the DOAP file:

> Must have at least one doap:maintainer property with a gnome:userid
> property

So I'm adding the previous maintainer.
2025-12-06 19:41:11 +01:00
Nick Wellnhofer
22f9d73089 io: Handle clashing error codes on AIX
Regressed with 2c2578b6f. Fixes #999.
2025-10-15 15:42:12 +02:00
Nick Wellnhofer
870c036341 fuzz: Make fuzzy encoding match more lenient
This should account for possible iconv suffixes.
2025-10-13 22:58:38 +02:00
Nick Wellnhofer
367a283b9a tree: Undeprecate several struct members 2025-10-07 12:01:05 +02:00
Nick Wellnhofer
3a3faaa253 Document process to remove API functions in MAINTAINERS.md 2025-10-07 12:00:51 +02:00
Nick Wellnhofer
2f62ebb3a7 io: Undeprecate xmlOutputBuffer members
The public API is too buggy, so direct access to struct members is
required by projects like libxslt.
2025-09-29 11:06:07 +02:00
Nick Wellnhofer
d87d94773e Revert "globals: Don't export DllMain on Windows"
This reverts commit bd2072f8d0.

Apparently, this change would require to recompile downstream code.
2025-09-29 10:50:00 +02:00
Nick Wellnhofer
bd2072f8d0 globals: Don't export DllMain on Windows
This shouldn't be done and lld 21 warns about it:

https://github.com/msys2/MINGW-packages/issues/17820
https://github.com/msys2/MINGW-packages/issues/25716

Regressed with f05af837.
2025-09-27 19:11:16 +02:00
Nick Wellnhofer
a30a276412 valid: Undeprecate xmlValidGetPotentialChildren
Fixes #988.
2025-09-26 16:29:10 +02:00
Lars Erik Wik
c537ccf0ae Fixed compilation error on GCC versions prior to 4.5
The deprecated attribute started accepting an optional string argument
in GCC version 4.5. Compiling libxml2 with GCC versions prior to that
would cause compilation errors such as:
```
./include/libxml/xmlmemory.h:134: error: wrong number of arguments specified for 'deprecated' attribute
```

Now the string argument is omitted for older versions of GCC.

Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
2025-09-25 11:29:05 +02:00
Nick Wellnhofer
da45a190f7 parser: Fix attribute normalization and standalone check
Regressed with e4cbc295.
2025-09-19 13:41:17 +02:00
Nick Wellnhofer
dc307e31fd meson: Fix install dir of man pages
Regressed when reworking documentation in 2.15.

Fixes #985.
2025-09-17 11:10:51 +02:00
Nick Wellnhofer
48df82f6ea Bump version to 2.16.0 2025-09-15 13:57:30 +02:00
Nick Wellnhofer
0bea77c828 Release v2.15.0 v2.15.0 2025-09-15 13:34:13 +02:00
Nick Wellnhofer
b9943bcaa3 Remove legacy win32 build system 2025-09-10 18:07:39 +02:00
Nick Wellnhofer
347147b555 Update NEWS 2025-09-08 16:02:59 +02:00
Nick Wellnhofer
1763281cd6 Remove LZMA support 2025-09-08 15:30:53 +02:00
Nick Wellnhofer
063add1b29 parser: Always require XML_PARSE_UNZIP to enable decompression 2025-09-08 15:14:33 +02:00
Nick Wellnhofer
8c107b690b Revert "dict: Rework reference counting"
This reverts commit 18bbdb5117 due to lack
of feedback.
2025-09-08 14:59:24 +02:00
Nick Wellnhofer
13962f820e valid: Fix null deref in xmlValidateOneAttribute
Short-lived regression from d53ba058.
2025-08-25 12:29:55 +02:00
Nick Wellnhofer
e397651a62 cmake: Omit version number from cmake install dir
Align with other build systems. Fixes #973.
2025-08-24 20:08:17 +02:00
Nick Wellnhofer
d53ba0588e valid: Don't add ids when validating entity content
The id table shouldn't reference ids in entities. The id will be created
when expanding the entity.

Probably regressed with d025cfbb.

Note that we still register ids in entities if entities are not
replaced. This is required to make IDREF checks work.

Fixes #974.
2025-08-23 14:59:55 +02:00
Nick Wellnhofer
56199b5c08 catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
Nick Wellnhofer
e2fdef4510 tests: Update testapi.c 2025-08-20 13:09:03 +02:00
Nick Wellnhofer
591f19ebe7 catalog: Deprecate low-level internal functions 2025-08-20 13:09:03 +02:00
Samuel Thibault
5bd6b44d13 Fix initGenericErrorDefaultFunc(NULL)
Calling initGenericErrorDefaultFunc(NULL) currently yields to

/usr/include/libxml2/libxml/xmlerror.h:23:45: error: invalid use of void expression
   23 |     xmlSetGenericErrorFunc(NULL, (h) ? *(h) : NULL)

Indeed, even if h is nul, the compiler will try to give a type to *(h),
which can't work.
2025-08-20 10:23:54 +02:00
Francesco Pretto
ca10c7d7b5 relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation
This allows to perform XML element validation skipping errors without recreating
a validation context. Tested it in runsuite.c in the rngTestStreaming() method.

Also added xmlRegExecClearErrors(exec) as necessary.
2025-08-18 10:18:41 +00:00
Nick Wellnhofer
f92a7a50d3 ci: Fix MSVC test by setting CMake generator manually
Visual Studio 2017 was removed from the Windows runners, but CMake still
picked it up for some reason.
2025-08-16 15:01:16 +02:00
Nick Wellnhofer
18bbdb5117 dict: Rework reference counting
Use C11 atomics if available. Otherwise, fall back to pthread mutex
inlined in xmlDict struct or Win32 atomics.

This should fix lock contention reported in #970.
2025-08-16 14:37:14 +02:00
Nick Wellnhofer
24caea6383 regexp: Avoid integer overflow and OOB array access
Limit size of 2D arrays to XML_MAX_ITEMS (1e9) to avoid overflow of int
indexes.

Fixes #950.
2025-08-12 18:47:00 +02:00