1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-05 05:47:00 +03:00

6875 Commits

Author SHA1 Message Date
Nick Wellnhofer
39e5b35bd0 parser: Don't create undeclared entity refs in substitution mode
We never want to create entity reference nodes if entity substitution
is enabled. This also applies to undeclared entities.
2024-05-03 11:46:01 +02:00
Nick Wellnhofer
ae23a4ce56 unicode: Deprecate most xmlUCSIs* functions
These don't seem to be used by downstream code.
2024-04-30 17:42:59 +02:00
Nick Wellnhofer
e637953527 Remove references to old mailing list 2024-04-30 17:00:01 +02:00
Nick Wellnhofer
d2f623d183 reader: Report malloc failure in xmlTextReaderConstValue 2024-04-30 16:36:44 +02:00
Nick Wellnhofer
b8597f46df tree: Handle predefined entities in xmlBufGetEntityRefContent
It's possible to create references to predefined entities using the tree
API. This edge case was exposed by making predefined entities const in
commit 63ce5f9a.
2024-04-30 16:05:42 +02:00
Nick Wellnhofer
619e2808b5 tree: Don't call xmlNewCharRef in xmlNodeParseContent
xmlNewCharRef also tries to handle strings like '&name;' but in
xmlNodeParseContentInternal, we really want to use the possibly invalid
name without modification. Otherwise, content like '&"' could
create a reference to a predefined entity.
2024-04-30 15:53:08 +02:00
Tomáš Ženčák
ae960cac96 Allow unlimited length decimals, integers etc. 2024-04-30 12:33:47 +02:00
Nick Wellnhofer
bffef46c4c doc: Don't install example code 2024-04-28 22:58:06 +02:00
Nick Wellnhofer
5f75c9560f doc: Remove tutorial
The tutorial was moved to the Wiki:

https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Tutorial
2024-04-28 22:57:02 +02:00
Nick Wellnhofer
d381e5de4a doc: Move doc/examples to example 2024-04-28 21:55:34 +02:00
Nick Wellnhofer
1cdfece12b memory: Remove memory debugging
This is useless compared to sanitizers or valgrind and has a
considerable performance impact if enabled accidentally.
2024-04-28 20:42:55 +02:00
Nick Wellnhofer
5e80f4381b tree: Deprecate xmlRegisterNodeDefault
This rarely used feature should be phased out.
2024-04-28 19:30:40 +02:00
Nick Wellnhofer
88169bfda6 tree: Deprecate xmlSetCompressMode 2024-04-28 19:30:39 +02:00
Nick Wellnhofer
05654cfe00 html: Deprecate htmlHandleOmittedElem 2024-04-28 18:58:27 +02:00
Nick Wellnhofer
63ce5f9aed Make some globals const 2024-04-28 17:53:39 +02:00
Nick Wellnhofer
577fb0e380 xinclude: Report malloc failure in xmlXIncludeMergeEntities 2024-04-27 16:31:01 +02:00
Nick Wellnhofer
68e440eec4 fuzz: Use all test directories for XML seed corpus
It's probably better to add as many files as possible to the seed corpus
even if they're less specific to a fuzzer.
2024-04-24 22:52:06 +02:00
Nick Wellnhofer
651465f98c test: Remove unused test files 2024-04-24 22:50:53 +02:00
Nick Wellnhofer
0977d7a3af fuzz: Build with compression support on OSS-Fuzz 2024-04-23 22:39:53 +02:00
Nick Wellnhofer
510c7988e0 fuzz: Remove reader pass from XML fuzzers
The reader API is fuzzed separately now.
2024-04-23 18:43:12 +02:00
Nick Wellnhofer
6641a7e824 fuzz: Enable reader fuzzer on OSS-Fuzz 2024-04-23 18:36:15 +02:00
Nick Wellnhofer
45fe9924f0 parser: Don't create reference in xmlLookupGeneralEntity
This should only be done in xmlParseReference.

The handling of undeclared entities is still somewhat inconsistent. In
element content we create references even if entity substitution is
enabled. In attribute values undeclared entities are always ignored.
2024-04-23 18:36:15 +02:00
Nick Wellnhofer
b717abdd09 parser: Consolidate error handling for undeclared entities
Always use XML_WAR_UNDECLARED_ENTITY with warning error level in
documents with external subset or parameter entities. Use
XML_ERR_UNDECLARED_ENTITY otherwise.
2024-04-23 18:36:15 +02:00
Nick Wellnhofer
00336f0fee cmake: Don't use tabs in CMakeLists.txt
Always use spaces and indent_size=4 except for Makefiles.
2024-04-23 18:16:03 +02:00
Nick Wellnhofer
b62ccf7f10 fuzz: Add fuzzer for XML reader API 2024-04-22 12:44:12 +02:00
Nick Wellnhofer
087a346448 xinclude: Increase error count in xmlXIncludeErrMemory 2024-04-22 12:44:12 +02:00
Nick Wellnhofer
7cbf609ae8 reader: Make xmlTextReaderReadString non-recursive
Also report malloc failures.

Fixes #607.
2024-04-22 12:44:12 +02:00
Nick Wellnhofer
f69647811c reader: Rework xmlTextReaderRead{Inner,Outer}Xml
Use an xmlOutputBuffer. Report malloc failures.
2024-04-22 12:44:12 +02:00
Nick Wellnhofer
cdb3103ba8 reader: Report malloc failures 2024-04-22 12:44:12 +02:00
Nick Wellnhofer
d2daf33e33 reader: Fix preservation of attributes
Don't use 'curnode' which might be an attribute or namespace node
which doesn't have an 'extra' member.
2024-04-22 12:44:12 +02:00
Nick Wellnhofer
5aa56e7397 reader: Add tests for content accessors 2024-04-22 12:44:12 +02:00
Niels Dossche
6053f1ff54 Remove redundant size check
The condition size > UINT_MAX - 10 is already checked earlier, so the
check is always false.
2024-04-19 15:33:40 +02:00
Nick Wellnhofer
fbea03f3d0 tree: Remove another redundant check in xmlDOMWrapCloneNode
The node type was already checked earlier.
2024-04-19 15:22:30 +02:00
Niels Dossche
1a865567d4 Remove redundant NULL check on cur
This variable is already NULL checked in the previous if condition.
2024-04-19 15:14:15 +02:00
Niels Dossche
6fadd7980a Remove always-false check old == cur
This case is already checked at the start of the function.
There it returns NULL, which seems more correct.
2024-04-19 15:14:15 +02:00
Niels Dossche
2766520062 Remove redundant NULL check on cur
cur = node, and node cannot be NULL as it is checked at the start of the
function.
2024-04-19 15:12:56 +02:00
Nick Wellnhofer
a0341ac8e9 tree: Don't return empty localname in xmlSplitQName{2,3}
Match the behavior of xmlSplitQName and xmlSplitQName4.
2024-04-18 12:11:13 +02:00
Nick Wellnhofer
f506ec6654 parser: Always decode entities in namespace URIs
Also decode entities in namespace URIs if entity substitution wasn't
requested. This should fix some corner cases when comparing namespace
URIs. The Namespaces in XML 1.0 spec says:

> In a namespace declaration, the URI reference is the normalized value
> of the attribute, so replacement of XML character and entity
> references has already been done before any comparison.

Make the serialization code escape special characters in namespace URIs
like in attribute values. This fixes serialization if entities were
substituted when parsing.

Fixes https://gitlab.gnome.org/GNOME/libxslt/-/issues/106
2024-04-15 12:34:26 +02:00
Nick Wellnhofer
971ce40409 fuzz: Also set fuzzAllocFailed if a real allocation fails
Avoid false positives in real OOM situations.
2024-04-14 19:40:22 +02:00
Nick Wellnhofer
20b0bd9800 fuzz: Account for quadratic runtime in xmlXPathTranslateFunction
Avoid fuzzer timeouts caused by this known issue.
2024-04-09 18:00:13 +02:00
Nick Wellnhofer
fd8a35114f error: Fix direct invocation of SAX error handlers
Revert part of commit c5a8aef2 to make it safe to call the default SAX
error handlers directly. This has been deprecated for a long time but
even xmllint still uses these handlers.

Should fix #713.
2024-04-09 16:54:02 +02:00
Nick Wellnhofer
20fca2bb3d save: Report malloc failure in xmlAttrSerializeTxtContent
Flush buffer before checking for errors.
2024-04-09 16:53:57 +02:00
Nick Wellnhofer
1f18d37798 fuzz: Add a few more comments 2024-04-09 13:04:50 +02:00
Seiya Nakata
5bb84b47b8 relaxng: Fix tree corruption in xmlRelaxNGParseNameClass
Don't create cycles in tree structure. This will lead to an infinite
loop or call stack overflow later.

Closes: https://gitlab.gnome.org/GNOME/libxml2/-/issues/711
2024-04-05 13:45:06 +02:00
Nick Wellnhofer
16ccb61dc1 xinclude: Don't try to fix base of non-elements
This would result in a spurious error.
2024-04-05 13:19:56 +02:00
Nick Wellnhofer
af2bda4e87 SAX2: Also check URI length before resolving
We don't want to exceed the size limit of 1 MB in uri.c. Such errors
can't be distinguished from malloc failures.
2024-04-05 13:09:45 +02:00
Vincent Torri
5732ce56f3 meson: Initial commit 2024-04-04 12:23:39 +02:00
Nick Wellnhofer
650f842dbe string: Don't validate UTF-8 in xmlUTF8Strsub
Most string functions can assume valid UTF-8. In order to detect malloc
failures reliably, xmlUTF8Strsub should only return NULL if the start
index is out of bounds or a memory allocation failed.
2024-04-02 15:34:45 +02:00
Nick Wellnhofer
86c27206f9 save: Handle invalid parent pointers in xhtmlNodeDumpOutput
See #255 and commit 85b1792e.
2024-04-02 15:34:45 +02:00
Nick Wellnhofer
f7f1453772 build: Disable support for compression libraries by default
libxml2 has limited support for reading and writing compressed data
with the help of zlib and liblzma which used to be enabled by default.
This only works for files read from the file system and never worked
with memory buffers. My guess is that this feature is virtually unused.

In light of the recently discovered xz backdoor, it's a good time to
disable these features by default to reduce attack surface and prepare
for eventual removal.

If --with-legacy is passed to the Autotools build, compression will
be enabled by default as before.
2024-04-02 13:25:56 +02:00