1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-12 09:17:37 +03:00
Commit Graph

294 Commits

Author SHA1 Message Date
Nick Wellnhofer
b0fc67aa22 build: Remove --with-tree configuration option
This option would allow for a smaller, but mostly useless minimal build.
But it complicates the symbol availability logic in an insane way and
requires specialized tools like our custom C parser in doc/apibuild.py.

See #717.
2024-06-16 18:47:12 +02:00
Nick Wellnhofer
0c97eaa772 xmllint: Rewrite HTML error output 2024-06-13 16:57:52 +02:00
Nick Wellnhofer
dba1ed85a3 ftp: Remove FTP support
Remove the built-in FTP client. If you configure --with-legacy, old
symbols are retained for ABI compatibility.
2024-06-12 18:19:55 +02:00
Nick Wellnhofer
5238404325 parser: Pass resource type to resource loader 2024-06-12 16:36:12 +02:00
Nick Wellnhofer
f96dca9c0e xmllint: Switch to resource loader 2024-06-12 16:36:12 +02:00
Nick Wellnhofer
e2919516bc xmllint: Fix build --with-valid --without-html 2024-06-06 19:28:23 +02:00
Nick Wellnhofer
caa8bb3848 fuzz: Move back to xmlSetExternalEntityLoader
xmlParserInputBufferCreateFilenameDefault can't report malloc failures.
2024-05-19 19:39:22 +02:00
Nick Wellnhofer
b3cb41be8b fuzz: Add xmllint fuzzer 2024-05-13 12:50:08 +02:00
Nick Wellnhofer
3dea98eff9 xmllint: Don't free DTD with --dropdtd
Entity references point to entities in the DTD, so only unlink the DTD
and don't destroy it.
2024-05-13 12:50:08 +02:00
Nick Wellnhofer
3ad7f81624 [CVE-2024-34459] Fix buffer overread with xmllint --htmlout
Add a missing bounds check.

Fixes #720.
2024-05-13 12:50:08 +02:00
Nick Wellnhofer
c83147bff2 xmllint: Fix --pedantic option
Regressed in 74c84a8c.
2024-05-13 12:50:08 +02:00
Nick Wellnhofer
3665d667f6 xmllint: Clean up option handling
Remove unnecessary globals and make some local.

Remove unnecessary calls to xmlTextReaderSetParserProp.

Remove unused "oldout" code.

Fix skipArgs.
2024-05-13 12:50:08 +02:00
Nick Wellnhofer
f8ff4d8688 xmllint: Rework parsing
Merge a few code paths, making options like --valid or --htmlout work
with some other options.

Improve error handling.
2024-05-07 17:11:18 +02:00
Nick Wellnhofer
3afaff7e8e xmllint: Check for NULL input in xmlHTMLValidityError
`ctxt->input` can be NULL after commit 61b4c42f.
2024-05-06 17:36:17 +02:00
Nick Wellnhofer
ef6e6012e2 xmllint: Fix parsing of maxmem option
Fix corner cases like 'xmllint --encode --maxmem 123'.

Also fixes --path without LIBXML_VALID_ENABLED.
2024-05-06 17:36:15 +02:00
Nick Wellnhofer
907a5a4885 xmllint: Fix memory leak in walkDoc 2024-05-06 17:35:26 +02:00
Nick Wellnhofer
f4826c8412 xmllint: Add macro for error stream
Prepare for fuzzing.
2024-05-06 00:33:19 +02:00
Nick Wellnhofer
826baf00d4 xmllint: Fix --insert option
Make sure that parent is an element when calling
xmlValidGetValidElements.
2024-05-06 00:32:08 +02:00
Nick Wellnhofer
20a0de95b4 xmllint: Fix --pushsmall option
This is only a debugging aid but also useful when fuzzing.
2024-05-06 00:32:08 +02:00
Nick Wellnhofer
a39e862b96 xmllint: Add explicit cast for -fsanitize=integer 2024-05-06 00:32:08 +02:00
Nick Wellnhofer
422ae4623a xmllint: Make some strings const 2024-05-05 17:26:11 +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
87bebd25f1 xmllint: Return error code if XPath returns empty nodeset
Return an error code as before but make it possible to distinguish from
real errors.

Fixes #690.
2024-02-12 16:47:12 +01:00
Nick Wellnhofer
d7d300ba04 parser: Remove remnants of runtime debugging feature
Apparently, this feature was remove long ago.

Fixes #651.
2024-01-04 17:50:11 +01:00
Nick Wellnhofer
7e0bbbc143 parser: New input API
Provide a new set of functions to create xmlParserInputs. These can be
used for the document entity or from external entity loaders.

- Don't require xmlParserInputBuffer.
- All functions take a base URI.
- All functions take an encoding as string.
- xmlNewInputURL also takes a public ID.
- xmlNewInputMemory takes a size_t.
- Optimization hints for memory buffers.

Improve documentation.

Only call xmlInitParser before allocating a new parser context.

Call xmlCtxtUseOptions as early as possible.
2023-12-29 01:22:13 +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
f9f5c2d889 xmllint: Don't use xmlGenericError 2023-12-21 15:02:24 +01:00
Nick Wellnhofer
d6812f3a48 Fix compiler warnings with disabled modules 2023-12-14 13:37:03 +01:00
Nick Wellnhofer
699299cae3 globals: Stop including globals.h 2023-09-20 22:07:40 +02:00
Nick Wellnhofer
11a1839ddd globals: Move remaining globals back to correct header files
This undoes a lot of damage.
2023-09-20 22:06:49 +02:00
Nick Wellnhofer
692a5c40ce xmllint: Don't set deprecated globals 2023-09-20 22:06:49 +02:00
Nick Wellnhofer
bfd7d28698 xmllint: Fix more error messages 2023-08-29 21:16:34 +02:00
Nick Wellnhofer
373244bc66 xmllint: Fix error message when push parsing empty documents 2023-08-29 21:05:32 +02:00
Nick Wellnhofer
ed3bd05284 parser: Allow to set maximum amplification factor 2023-08-20 20:49:16 +02:00
Nick Wellnhofer
305a75ccbe malloc-fail: Fix null-deref with xmllint --copy
See #344. Fixes #552.
2023-06-06 13:15:46 +02:00
Nick Wellnhofer
886bf4e63b Stop calling xmlMemoryDump
This was used to check for memory leaks but could potentially create a
.memdump file. These days, there are better ways to check for memory
leaks.
2023-04-30 15:48:41 +02:00
Nick Wellnhofer
db32b09d50 xmllint: Validate --maxmem integer option
Fixes #520.
2023-04-20 16:22:11 +02:00
Nick Wellnhofer
64b76f8163 xmllint: Fix memory leak with --pattern --stream
Fixes #499.
2023-03-14 14:55:39 +01:00
Nick Wellnhofer
d7daf9fd96 xmllint: Fix use-after-free with --maxmem
Fixes #498.
2023-03-14 14:55:34 +01:00
Nick Wellnhofer
60d457be30 libxml.h: Don't include stdio.h 2022-12-08 04:24:57 +01:00
Nick Wellnhofer
dd3569eaa5 Remove XMLDECL macro from .c files 2022-12-08 02:43:17 +01:00
Alex Richardson
4b959ee168 Remove hacky heuristic from b2dc5675e9
Checking whether the context is close to the parent context by hardcoding
250 is not portable (I noticed tests were failing on Morello since the value
is 288 there due to pointers being 128 bits). Instead we should ensure
that the XML_VCTXT_USE_PCTXT flag is not set in cases where the user data
is not actually a parser context (or ideally add a separate field but that
would be an ABI break.

From what I can see in the source, the XML_VCTXT_USE_PCTXT is only set if
the userData field points to a valid context, and if this is not the case
the flag should be cleared when changing userData rather than relying on
the offset between the two. Looking at the history, I think
d7cb33cf44 fixed most of the need for this
workaround, but it looks like there are a few more locations that need
updating; This commit changes two more places to set/clear/copy the
XML_VCTXT_USE_PCTXT flag, so this heuristic should not be needed anymore.
I've also drop two = NULL assignment in xmllint since this is not needed
after a call to memset().

There was also an uninitialized vctxt.flags (and other fields) in
`xmlShellValidate()`, which I've fixed by adding a memset() call.
2022-12-01 15:31:25 +00:00
Nick Wellnhofer
701beb4ec7 xmllint: Include <io.h> on Windows 2022-11-22 16:03:05 +01:00
Nick Wellnhofer
e85f9b98a5 xmllint: Improve handling of empty XPath node sets
Don't return an error if the result is an empty node set. Suppress the
"XPath set is empty" message in quiet mode.

Fixes #180.
2022-10-19 02:51:14 +02:00
Nick Wellnhofer
5bffa33a12 Stop including sys/types.h 2022-09-02 18:33:36 +02:00
Nick Wellnhofer
74c84a8c9f xmllint: Don't set deprecated globals
Setting parser options should be enough.
2022-08-24 16:15:04 +02:00
Nick Wellnhofer
ce93ee9051 xmllint: Stop calling xmlSAXDefaultVersion
This should already be handled by setting XML_PARSE_SAX1.
2022-08-24 14:07:57 +02:00
Nick Wellnhofer
9a82b94a94 Introduce xmlNewSAXParserCtxt and htmlNewSAXParserCtxt
Add API functions to create a parser context with a custom SAX handler
without having to mess with ctxt->sax manually.
2022-08-24 14:07:55 +02:00