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

7571 Commits

Author SHA1 Message Date
Nick Wellnhofer
347c2b2ec7 valid: Deprecate a few functions and xmllint --insert 2025-06-02 23:54:28 +02:00
Nick Wellnhofer
f6eec6f4c1 globals: Remove lineNumbersDefaultValue from globals struct 2025-06-02 22:45:19 +02:00
Nick Wellnhofer
ac6ae39192 valid: Readd more argument checks in xmlAddElementDecl
Fix crashes with API fuzzer.
2025-06-02 14:33:15 +02:00
Nick Wellnhofer
0f8543e11d parser: Fix error reporting in xmlSkipBlankCharsPEBalanced
Short-lived regression.
2025-06-02 14:19:01 +02:00
Nick Wellnhofer
6a6a46f017 doc: Fix autolink errors
Fix links, remove links to internal functions.
2025-05-28 16:02:41 +02:00
Nick Wellnhofer
7bd8d1d9cc doc: Prefix autolinks with '#'
Use `#func` instead of `func()` to ignore parameters and make all
autolinks work.
2025-05-28 16:01:52 +02:00
Nick Wellnhofer
6e33d136e1 error: Fix initGenericErrorDefaultFunc compatibility macro again
Now it really should work as before.
2025-05-28 14:57:37 +02:00
Nick Wellnhofer
8baa5de182 parser: Avoid integer overflow in xmlParseCharDataInternal
`nbchar` could overflow with larger than 2GB memory buffers which some
new APIs allow. This shouldn't affect memory safety.

Limit maximum amount of bytes passed to character callback to
XML_MAX_ITEMS (1e9).
2025-05-27 20:03:13 +02:00
Nick Wellnhofer
35d04a0848 README: Set expectations straight
Fixes #913.
2025-05-27 20:03:13 +02:00
Nick Wellnhofer
ad346c9a24 tree: Fix integer overflow in xmlBuildQName
This issue affects memory safety and might receive a CVE ID later.

Fixes #926.
2025-05-27 20:03:13 +02:00
Nick Wellnhofer
77c583e0f7 valid: Readd argument check in xmlAddElementDecl
Fix crashes with API fuzzer.
2025-05-27 19:55:36 +02:00
Nick Wellnhofer
78454e30e9 io: Remove xmlInputDefaultOpen
Not necessary after removal of HTTP client.
2025-05-27 19:55:36 +02:00
Nick Wellnhofer
b79cf4743b globals: Fix memory leak on Windows DLL unload
Thread-local memory must be freed for the main thread as well after
4f08a1a2.

Fixes #925.
2025-05-27 19:54:59 +02:00
Nick Wellnhofer
ab06bfa1f6 parser: Fix error return in xmlParseElementContentDecl
Avoid internal error later in xmlValidBuildAContentModel after
2a60ca06c.

Also avoids some unnecessary error messages.
2025-05-26 16:51:59 +02:00
Nick Wellnhofer
30cf6d0980 parser: Add XML_INPUT_USE_SYS_CATALOG
Also clean up catalog resolution and add error handling using the
global error.

Don't try to look up the resolved URI a second time.

Add some comments. Fix documentation.
2025-05-26 16:51:59 +02:00
Nick Wellnhofer
34bafa14fe parser: Use parser context as default in resource loader
This allows to access the original context for example when using
modules like XInclude or schemas.
2025-05-25 22:47:34 +02:00
Nick Wellnhofer
997830a338 tests: Always use xmlMalloc/xmlFree 2025-05-25 22:47:34 +02:00
Nick Wellnhofer
c136118dcc README: Mention CMake single/multi-config 2025-05-25 14:26:30 +02:00
Nick Wellnhofer
4dc44c83ab parser: Rework entity boundary check for element content
Only use depth of input stack. This makes the input ID unused
internally.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
74ea6b483c parser: Start using input depth for entity boundary check
Now that we make sure that PEs starting markup won't be popped
implicitly, it's enough to check that no new entities are on the stack
when checking boundaries.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
6f8ac9538c valid: Don't use element namespace for attributes
This makes no sense. Unprefixed attributes never have a namespace.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
5ec83f7741 valid: Remove duplicate #FIXED check for namespaces
Unlike the comment indicates, this is already checked.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
7c10fff265 valid: Don't validate twice in xmlAddAttributeDecl
This should only be done in xmlValidateAttributeDecl.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
db65b2fc51 SAX1: Align handling of default attributes with SAX2
The SAX1 parser is legacy code, but it seems more maintainable to align
it with SAX2.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
e4cbc295fa parser: Check attribute normalization standalone constraint
To fully implement "VC: Standalone Document Declaration", we have to
check for normalization changes caused by non-CDATA attribute types
declared externally.

Fixes #119.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
682195c869 parser: Fix "Proper Declaration/PE Nesting" validity constraint
Now that we handle "WFC: PE Between Declarations" correctly, we can turn
"Proper Declaration/PE Nesting" from a WFC into VC as specified.

Fixes #118.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
74ff6c0028 error: Fix line number in entities
Allow line numbers from more domains, see code above.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
2f3655c9c3 parser: Pop PEs that start markup declarations explicitly
We currently only handle "Validity constraint: Proper Declaration/PE
Nesting", but we must detect "Well-formedness constraint: PE Between
Declarations" separately:

> The replacement text of a parameter entity reference in a DeclSep must
> match the production extSubsetDecl.

PEs in DeclSeps are PEs that start with a full markup declaration (or
another PE). These are handled in xmParse{Internal|External}Subset. We
set a flag on these PEs and don't close them implicitly in
xmlSkipBlankCharsPE. This will make unterminated declarations in such
PEs cause a parser error. The PEs are closed explicitly in
xmParse{Internal|External}Subset, the only location where they are
allowed to end.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
2a60ca06c0 valid: Don't check enum values
Rely on the parser to pass valid arguments.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
4aa7192f21 tests: Add dtor for xmlElementContent in testapi.c 2025-05-25 14:26:30 +02:00
Nick Wellnhofer
fc1cabc822 valid: Also raise duplicate ID error without validation support
Whether an error is raised should not depend on config options.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
dd1961e0d8 valid: Skip more validity checks if not validating 2025-05-25 14:26:30 +02:00
Nick Wellnhofer
6c2bd9758f valid: Don't validate unused default attributes
See erratum E9 of XML 1.0 Second Edition.

See #120.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
fca0860d6c tree: Deprecate public struct members related to DTDs
Let's deprecate these members for now. If these are really used, they
can be undeprecated later.
2025-05-25 14:26:30 +02:00
Dag-Erling Smørgrav
3ab040c203 Fix unidiomatic use of vsnprintf().
* Don't terminate an already-terminated buffer.
* Consistently use 1024-byte buffers.
* While here, consistently use ap for a va_list.
2025-05-24 01:28:49 +02:00
Dag-Erling Smørgrav
8ea253b895 Remove bogus casts.
* Casting a string literal to `char *` and then immediately passing or
  assigning the result to a `const char *` makes no sense.
* There is no need to cast `int` to `Py_ssize_t` as they have the same
  sign and the latter is at least as wide as the former.
2025-05-24 01:28:21 +02:00
Nick Wellnhofer
7c9b55356d doc: Document unused error domains 2025-05-19 20:07:54 +02:00
Nick Wellnhofer
47aca2c6c9 parser: Only check validity contraints when validating 2025-05-19 20:07:54 +02:00
Nick Wellnhofer
3a68d0b7a8 SAX2: Handle xml:id errors separately 2025-05-19 20:07:54 +02:00
Nick Wellnhofer
172550d225 parser: Only validate EnumerationTypes when requested
This has quadratic behavior and is only a validity constraint.
2025-05-19 19:58:33 +02:00
Nick Wellnhofer
7008740a96 parser: Consolidate scanning of XML Names
Use new productions by default.

Fixes #194.
Fixes #364.
See #707.
2025-05-19 19:58:33 +02:00
Nick Wellnhofer
657254a87f parser: Factor out xmlIsNameCharNew/Old 2025-05-18 01:23:25 +02:00
Nick Wellnhofer
315bd443c5 meson: Switch to cfg_data.set10() 2025-05-17 18:59:52 +02:00
Nick Wellnhofer
4e5945fc3c cmake: Avoid overlinking with non-CMake libxml2-config.cmake
Align libxml2-config.cmake generated by Autotools and Meson with the
CMake version and only add dependencies to libraries when linking
statically. Also set LIBXML_STATIC for static builds.

Fixes #918.
2025-05-17 18:52:36 +02:00
Nick Wellnhofer
faaa01b8c1 cmake: Make iconv a private dependency
This was only needed for the headers before 2.14.
2025-05-17 18:52:11 +02:00
Nick Wellnhofer
70e5d664ea doc: Don't document deprecated headers 2025-05-17 01:31:55 +02:00
Nick Wellnhofer
7c82391c64 codegen: Factor out code to generate range tables 2025-05-17 01:29:37 +02:00
Nick Wellnhofer
502c5f658a meson: Dependency on directory doesn't work 2025-05-17 00:11:03 +02:00
Nick Wellnhofer
210f5a3746 chvalid: Mark functions as deprecated 2025-05-16 23:27:51 +02:00
Nick Wellnhofer
954aae907d doc: Improve regexp documentation 2025-05-16 21:13:17 +02:00