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

6274 Commits

Author SHA1 Message Date
Nick Wellnhofer
c73de050f5 include: Move non-generated parts from xmlversion.h.in
xmlexports.h originally only included symbol visibility macros but it's
a good place for other macros as well.
2023-12-25 23:38:40 +01:00
Nick Wellnhofer
a18d94168b Update NEWS 2023-12-24 22:11:49 +01:00
Nick Wellnhofer
229e5ff7f9 io: Remove support for HTTP POST
This feature is unlikely to be used these days.
2023-12-24 22:11:49 +01:00
Nick Wellnhofer
9c2c87b55d dict: Move local RNG state to global state
Don't use TLS variables directly.
2023-12-24 16:24:34 +01:00
Nick Wellnhofer
2e9e758d1e dict: Get random seed from system PRNG 2023-12-24 16:24:34 +01:00
Nick Wellnhofer
c49572e57d malloc-fail: Fix erroneous report in xmlStringGetNodeList
The parser can produce invalid attribute content in recovery mode.
Unless this is fixed, xmlStringGetNodeList should ignore such errors
silently.
2023-12-23 15:10:15 +01:00
Nick Wellnhofer
c8f1f4a280 doc: Improve documentation of error handlers 2023-12-21 17:36:17 +01:00
Nick Wellnhofer
882b3a8075 runtest: Fix return code in rngTest 2023-12-21 15:34:24 +01:00
Nick Wellnhofer
f0df3e6d00 tests: Try to fix RelaxNG test cases
These were added recently in ea695ac0 and 8074b881 but were a total mess
of symbolic links and apparently mixed up files.

Symbolic links don't work on Windows.

Try to salvage one of the tests.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
8cd563174a html: Don't close fd in htmlCtxtReadFd
Long-standing bug. The XML fix from 2003 was never ported to the HTML
parser. htmlReadFd was fixed with fe6890e2.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
0a658c0f0a io: Don't use "-" to read from stdin
To implement this feature on such a low level is a disaster waiting to
happen. Remove these checks from the IO code and move them to xmllint.

Note that the serialization API will still treat "-" as stdout.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
c9a46a91fe io: Rework initialization 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
b75fc1ab33 io: Rearrange code 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
130436917c parser: Rename xmlErrParser to xmlCtxtErr 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
8d0aaf4b95 parser: Remove xmlErrEncoding
Use xmlFatalErr or xmlCtxtErrIO.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
9fbe46ba17 io: Consolidate error messages 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
23345a1cb1 io: Report IO errors through xmlCtxtErrIO
This is also a new public API function to be used in external entity
loaders.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
e62b0dbde5 xzlib: Fix harmless unsigned integer overflow 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
1ef3566362 io: Always use unbuffered input
Before, we often used unbuffered input via the lzma or gzip handlers,
more or less inadvertently.

Change the default file handlers from buffered (stdc FILE) to unbuffered
(POSIX fds).
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
7e14c05df2 io: Fix detection of compressed streams
Make sure that we don't try to open uncompressed streams with a
compression handler in copying mode.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
7e511f35f1 io: Pass error codes from xmlFileOpenReal to xmlNewInputFromFile
This allows to report the reason why opening a file failed to the parser
context and improve error messages. Now we can also remove the stat call
before opening a file.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
b2dbcc432b io: Rework default callbacks
Register a dummy callback struct for default callbacks. Handle them in a
separate function which will later allow to return meaningful error
codes.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
531d06add6 error: Stop printing some errors by default
Unfortunately, it's long-standing behavior for libxml2 to print all
reported errors to stderr by default. This default behavior is now
partially disabled. If no error handler is set, only parser and
validation errors are passed to a generic error handler or printed to
stderr. Other errors are still available via xmlGetLastError and can be
captured with a structured error handler.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
0c7a364f57 error: Remove xmlSimpleError 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
f9f5c2d889 xmllint: Don't use xmlGenericError 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
e9c01c30a3 runtest: Test with per-context error handlers
Only set the global error handler where needed.

Don't use xmlGenericError.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
05d9bacd05 regexp: Improve error handling
Handle malloc failure from xmlRaiseError.

Use xmlRaiseMemoryError.

Remove argument from memory error handler.

Remove TODO macro.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
ecb4c9fb28 misc: Improve error handling
Remove calls to generic error handler or use stderr for

- legacy deprecation warnings
- nanohttp, nanoftp in standalone mode
- memory debug messages

Use xmlRaiseMemoryError.

Remove TODO macro.

Don't raise errors in xmlmodule.c.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
bc1e030664 save: Improve error handling
Handle malloc failrue from xmlRaiseError.

Use xmlRaiseMemoryError.

Stop using xmlGenericError.

Remove argument from memory error handler.

Remove TODO macro.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
664db89e0e schematron: Improve error handling
Implement xmlSchematronVErr.

Handle malloc failure from xmlRaiseError.

Stop using xmlGenericError.

Remove argument from memory error handler.

Use xmlRaiseMemoryError.

Remove TODO macro.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
83c6aeef49 relaxng: Improve error handling
Pass RelaxNG structured error handler to XML parser.

Handle malloc failure from xmlRaiseError.

Remove argument from memory error handler.

Use xmlRaiseMemoryError.

Don't use xmlGenericError.

Remove TODO macro.
2023-12-21 15:01:42 +01:00
Nick Wellnhofer
be76b7dfe3 debug: Improve error handling
Print to debug output instead of global error handler.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
25e22011db c14n: Improve error handling
Handle malloc failure from xmlRaiseError.

Add context argument to error functions.

Remove argument from memory error handler.

Use xmlRaiseMemoryError.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
6cb8420a9e catalog: Improve error handling
Handle malloc failures from xmlRaiseError.

Remove arguments from memor error handler.

Remove TODO macro.

Make debugging code print to stderr instead of xmlGenericError.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
06c00f6582 schemas: Improve error handling
Introduce xmlSchema*ErrFull which checks for memory allocation failures
during error reporting.

Remove arguments from memory error handlers.

Use xmlRaiseMemoryError.

Remove TODO macro.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
ed6596a47a reader: Simplify error handling
Only use structured error handlers for parser, Schemas and RelaxNG
contexts. Also use structured error handler for XInclude context.

Remove TODO macro.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
2829a21a95 xinclude: Improve error handling
Introduce xmlXIncludeSetErrorHandler allowing to set a structured error
handler for an XInclude context and forwarding errors from parser.

Remove arguments from memory error handlers.

Use xmlRaiseMemoryError.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
954b898494 xpath: Improve error handling
Introduce xmlXPathSetErrorHandler allowing to set a structured error
handler for an XPath context.

Remove arguments from memory error handlers.

Use xmlRaiseMemoryError.

Remove TODO, STRANGE and CHECK_CTXT macros.

Remove remaining uses of xmlGenericError.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
54c70ed57f parser: Improve error handling
Introduce xmlCtxtSetErrorHandler allowing to set a structured error for
a parser context. There already was the "serror" SAX handler but this
always receives the parser context as argument.

Start to use xmlRaiseMemoryError.

Remove useless arguments from memory error functions. Rename
xmlErrMemory to xmlCtxtErrMemory.

Remove a few calls to xmlGenericError.

Remove support for runtime entity debugging.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
c5a8aef2f6 error: Refactor error reporting
Introduce xmlStrVASPrintf, trying to handle buggy snprintf
implementations.

Introduce xmlSetError to set errors atomically.

Introduce xmlUpdateError to set an error, fixing up node, file and line.

Introduce helper function xmlRaiseMemoryError.

Make legacy error handlers call xmlReportError, avoiding checks in
xmlVRaiseError.

Remove fragile support for getting file and line info from XInclude
nodes.
2023-12-21 02:46:27 +01:00
Mike Dalessio
ed3ad3e173 Makefile.am: omit $(top_builddir) from DEPS and LDADDS
BSD make is less liberal than GNU make in matching targets, and so it
tries to resolve the dependency `./libxml2.la` and fails to match the
target `libxml2.la`.
2023-12-20 23:43:08 +00:00
Nick Wellnhofer
6fdc20ba36 xpath: Don't free nodes of XSLT result value trees
This feature hasn't been required for a long time and libxslt works
around by manually setting 'boolval' to 0.
2023-12-20 19:00:42 +01:00
Nick Wellnhofer
bcefef202e malloc-fail: Report malloc failure in xmlXPathNumberFunction 2023-12-20 14:40:27 +01:00
Nick Wellnhofer
355fbe3ab7 valid: Fix handling of enumerations
Make xmlFreeEnumeration, xmlCopyEnumeration and xmlDumpEnumeration
non-recursive. Report malloc failure in xmlCopyEnumeration.
2023-12-16 15:10:15 +01:00
Nick Wellnhofer
6ae98ebc64 malloc-fail: Report malloc failure in xmlXPathTranslateFunction 2023-12-15 15:03:39 +01:00
Nick Wellnhofer
69d88566b6 malloc-fail: Fix OOM error handling in xmlSwitchInputEncoding
Make sure that in->buffer won't be set to NULL if a memory allocation fails.

Short-lived regression.
2023-12-15 15:03:39 +01:00
Nick Wellnhofer
6c8acdecd2 save: Fix build --without-html
Fixes #646
2023-12-14 13:49:08 +01:00
Nick Wellnhofer
5d2dbe79fa parser: Fix build --without-output
Fixes #647
2023-12-14 13:48:41 +01:00
Nick Wellnhofer
d6812f3a48 Fix compiler warnings with disabled modules 2023-12-14 13:37:03 +01:00
Nick Wellnhofer
1c106edf2b parser: Allow recovery in xmlParseInNodeContext
Should fix #645.
2023-12-13 23:58:59 +01:00