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

7744 Commits

Author SHA1 Message Date
Nick Wellnhofer
0c948334a8 html: Add newline to error message 2025-07-10 12:46:40 +02:00
Nick Wellnhofer
bc0bb67b57 html: Don't abort on encoding errors
Always enable recovery mode when parsing HTML, so we don't raise fatal
errors.

Regressed with 462bf0b7. Fixes #947.
2025-07-10 12:46:22 +02:00
Nick Wellnhofer
3773bb3f89 tree: Make sure that SIZE_MAX is defined 2025-07-09 16:09:56 +02:00
Nick Wellnhofer
6340f39284 doc: Document HTML type aliases 2025-07-09 15:19:46 +02:00
Nick Wellnhofer
bd9d5e39ec parser: Fix handling of invalid char refs in recovery mode
Revert to the old behavior which handles invalid char refs more
gracefully. Probably regressed with 37c6618b (version 2.13.0).
2025-07-09 14:58:26 +02:00
Nick Wellnhofer
6c796b3792 doc: Misc fixes 2025-07-09 13:17:39 +02:00
Nick Wellnhofer
c7a9ef1d66 doc: Document struct typedefs
Unfortunately, Doxygen's TYPDEF_HIDES_STRUCT option is too broken.
Document struct typedefs to make autolinks work.
2025-07-04 16:47:42 +02:00
Nick Wellnhofer
71e1e8af5e schematron: Fix memory safety issues in xmlSchematronReportOutput
Fix use-after-free (CVE-2025-49794) and type confusion (CVE-2025-49796)
in xmlSchematronReportOutput.

Fixes #931.
Fixes #933.
2025-07-04 14:44:54 +02:00
Nick Wellnhofer
24d7e15914 schematron: Complete fix for CVE-2025-49795
- Fix memory leaks
- Fix tests
2025-07-04 12:46:29 +02:00
Michael Mann
499bcb78ab Schematron: Fix null pointer dereference leading to DoS
(CVE-2025-49795)

Fixes #932
2025-07-04 09:35:14 +00:00
Michael Mann
069bcda17d Fix potential buffer overflows of interactive shell
CVE-2025-6170

Fixes #941
2025-07-02 13:29:19 -04:00
Nick Wellnhofer
c34742f301 tests: Fix build --without-output 2025-06-30 16:23:54 +02:00
Nick Wellnhofer
9553695d17 relaxng: Make xmlRelaxNGDump depend on debug option 2025-06-30 16:23:54 +02:00
Omar Siam
9760a14fb9 relaxng: In the simplification step also unlink notAllowed refs from choice
This fixes false reports of non allowed content compared to notAllowed as tag within the choice tag.
2025-06-30 13:47:33 +00:00
Nick Wellnhofer
56a767ed58 doc: Small fix 2025-06-28 15:21:44 +02:00
Nick Wellnhofer
0d52684e31 parser: Don't set dict limit when setting options
This is done in xmlCtxtInitializeLate.
2025-06-28 15:21:44 +02:00
Nick Wellnhofer
1b737cc810 parser: Another fix to ]]> detection in push parser
The original fix for issue #850 in commit 9efe1414 was incomplete.
2025-06-28 15:21:20 +02:00
Nick Wellnhofer
70dc8ca03d xpath: Add extra info to some error messages
Fixes #660.
2025-06-27 18:54:18 +02:00
Daniel P. Berrangé
ac5fcb0e34 relaxng: ensure thread safe global initialization
Relying on a plain integer flag, with no synchronization primitives does
not give thread-safe initialization. All reads & writes of the
xmlSchemaTypesInitialized flag need to be protected by a mutex to ensure
suitable memory barriers & thus correct ordering wrt any speculative
execution.

A separate internal initializer tied to xmlParserInit is used to create
the mutex used for synchronization, similarly to how catalog.c works.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-06-26 17:46:19 +01:00
Daniel P. Berrangé
80798c406c xmlschemastypes: ensure thread safe global initialization
Relying on a plain integer flag, with no synchronization primitives does
not give thread-safe initialization. All reads & writes of the
xmlSchemaTypesInitialized flag need to be protected by a mutex to ensure
suitable memory barriers & thus correct ordering wrt any speculative
execution.

A separate internal initializer tied to xmlParserInit is used to create
the mutex used for synchronization, similarly to how catalog.c works.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-06-26 17:46:01 +01:00
Nick Wellnhofer
63f98ee8a3 tests: Skip functions taking va_lists in testapi.c
See !325.
2025-06-25 14:33:20 +02:00
Nick Wellnhofer
d4355722c2 xmllint: Print document even in case of XInclude errors
Keep printing the document while still reporting XInclude errors to
match the old behavior.
2025-06-25 14:07:43 +02:00
Nick Wellnhofer
413cdfb34a html: Fix push parsing of doctype decls
Don't set state to "content" as we might still be in "misc" or "prolog".
2025-06-25 12:41:32 +02:00
Nick Wellnhofer
ad0f5d27c4 tree: Fix xmlGetNodePath
- Fix quadratic behavior
- Don't truncate names

Fixes #715.
2025-06-24 13:57:20 +02:00
Nick Wellnhofer
22246f21c5 schemas: Fix compilation with pre-C99 MSVC
Regressed with f307237e.

Fixes #944.
2025-06-23 23:03:02 +02:00
Nick Wellnhofer
7cfa3a2650 reader: Remove unused member xinclude_name 2025-06-23 22:59:31 +02:00
Nick Wellnhofer
6c5b555237 debug: Remove obsolete handling of special case
The "nbktext" code was removed.
2025-06-23 22:59:31 +02:00
Nick Wellnhofer
24628f2590 valid: Don't store attribute defaults in dictionary
In general, we should only use dicts for names and not values.
2025-06-23 22:59:31 +02:00
Nick Wellnhofer
600742f0f1 valid: Unconst local variable in xmlValidateElement 2025-06-23 22:59:31 +02:00
Nick Wellnhofer
7c91385040 parser: Remove unnecessary dict checks when freeing strings
The following strings are never allocated from a dict:

- xmlParserCtxt.version
- xmlParserCtxt.encoding
- xmlParserCtxt.extSubURI
- xmlParserCtxt.extSubSystem
- xmlDoc.version
- xmlDoc.encoding
- xmlDoc.URL
- xmlDTD.ExternalID
- xmlDTD.SystemID
- xmlID.value

Also make the struct members point to non-const chars to avoid casts
when freeing.
2025-06-23 22:59:31 +02:00
Nick Wellnhofer
607708b35f valid: Don't store ID values in document's dictionary
ID values are unique. There's some potential for them to be reused as
references, but storing them in the dictionary can make the dictionary
grow in proportion to the document.

Users like lxml replace the `ids` hash table to avoid this. It seems
like a good idea to stop using the dictionary for ID values.
2025-06-23 22:59:19 +02:00
Nick Wellnhofer
ea91a507dd doc: Generate documentation with Doxygen 1.14
The 1.14.0 release fixes a serious bug with autolinks.

Note that the downstream tests now run on Ubuntu with libxml2 and
libxslt built on Arch. This seems to work but could break at a later
point.

Fixes #929.
2025-06-22 17:21:26 +02:00
Nick Wellnhofer
3652fc28ec doc: Fix installation with newer Doxygen
Newer versions don't generate PNG files anymore. Simply use *.* as
wildcard.
2025-06-22 17:14:41 +02:00
Nick Wellnhofer
404aedbd97 doc: Improve xmllint documentation 2025-06-22 15:53:01 +02:00
Michael Mann
dd2b4091fb xmllint: Add --strict-namespace option
Use xmlCtxtGetStatus() after parsing. If status indicates a namespace error while the --strict-namespace option is enabled, xmllint will exit with XMLLINT_ERR_RDFILE error

Fixes #698
2025-06-22 13:40:22 +00:00
Michael Mann
bf26cf9d08 xmllint: Replace boolean application options with single flag member
Take all of the boolean application options and create a bitmask for each of them.  Then use just a single unsigned member to keep track off all of them (regardless of precompile directives)
2025-06-22 13:40:22 +00:00
Michael Mann
be812e1e5a xmllint: Rename options -> parseOptions
Make it more obvious the options are related to XML parsing
2025-06-22 13:40:22 +00:00
Nick Wellnhofer
e7802738c6 parser: Don't load external content if only XML_SKIP_IDS is set
At some point, the `loadsubset` member was augmented to also control
handling of ID attributes in addition to loading of external DTDs. These
two features are unrelated and shouldn't have been mixed. This mistake
was probably inspired by the misnamed XML_DETECT_IDS flag. As a side
effect, setting XML_SKIP_IDS always enabled loading of external DTDs and
parameter entities.

This change makes it possible to ignore IDs without loading external
content. This is a deliberate API change that improves security and is
unlikely to affect users.

This also makes sure that the new XML_PARSE_SKIP_IDS option doesn't
enable unsafe behavior.
2025-06-22 15:18:43 +02:00
Nick Wellnhofer
b424bae705 html: Fix pull-parsing of initial comments and doctype decls
- Parse more bogus comments and multiple doctype declarations before
  switching to content.
- Grow buffer after parsing comment.
2025-06-22 14:31:38 +02:00
Nick Wellnhofer
1c96d5ef51 parser: Add comment in xmlStopParser 2025-06-22 14:31:26 +02:00
Nick Wellnhofer
7e3818424a include: s/char const/const char/ 2025-06-22 14:31:26 +02:00
Nick Wellnhofer
19139061fb include: Define XMLPUBVAR directly
Using an intermediate macro confuses newer Doxygen versions for some
reason.
2025-06-22 14:31:26 +02:00
Nick Wellnhofer
a4d25b3d93 doc: Small fixes 2025-06-22 14:31:26 +02:00
Michael Mann
cf4f967266 Add XML_PARSE_SKIP_IDS to replace XML_SKIP_IDS
Mark loadset member as deprecated

Fixes #873
2025-06-22 08:03:34 -04:00
Nick Wellnhofer
1dcd3df20b parser: Fix xmlCtxtIsStopped
Make xmlCtxtIsStopped check for fatal errors as well. This makes it
easier to migrate away from disableSAX.
2025-06-20 23:46:46 +02:00
Nick Wellnhofer
9c6eebac17 xmllint: Fix --xinclude --path
Use resource loader for XInclude. Regressed with f96dca9c.
2025-06-20 22:29:57 +02:00
Nick Wellnhofer
2963a0f13a tree: Undeprecate some members used by libxslt 2025-06-20 21:41:24 +02:00
Markus Rickert
477f9c6b20 Fix CMake iconv handling after change to private dependency 2025-06-18 13:48:55 +02:00
Nick Wellnhofer
a3992815b3 parser: Fix buffer overflow when parsing PublicIds
Regressed with 8231c0366 and 30665ae4.
2025-06-12 13:51:37 +02:00
Nick Wellnhofer
30665ae4d1 parser: Fix parsing of PublicIds and VersionNums
Regressed in 8231c0366.

Fixes #940.
2025-06-11 18:36:50 +02:00