Nick Wellnhofer
9f496fdb8c
xmllint: Return early on invalid args
...
At this point, no memory was allocated and xmllintOom wasn't
initialized. Return immediately on invalid args to avoid triggering
false positive unreported OOM errors when fuzzing.
2025-05-03 14:33:06 +02:00
Nick Wellnhofer
69879da88f
doc: Remove email addresses from documentation
...
Also remove authorship information from generated files, hash.c and
globals.c which were rewritten.
2025-05-01 23:23:42 +02:00
Nick Wellnhofer
61890e399d
doc: Prepare for conversion to Doxygen
...
Fix many params in internal functions (not really necessary but Doxygen
warns about that in XML mode).
Fix formatting in a few corner cases that automatic conversion can't
handle.
Rearrange some DOC_DISABLE blocks.
2025-05-01 23:23:42 +02:00
Nick Wellnhofer
177067ea5a
reader: Fix reading compressed data
...
Also make sure that functions that don't return error codes set the
global error.
2025-04-25 15:36:59 +02:00
Nick Wellnhofer
2d8b6df28a
xmllint: Make --nocatalogs actually work
2025-04-19 14:52:14 +02:00
Nick Wellnhofer
ffc0bba93e
xmllint: Remove --htmlout option
...
Unlike the documentation suggests, this only printed error messages as
HTML which doesn't seem useful.
2025-04-19 14:52:14 +02:00
Nick Wellnhofer
dc4910c70a
xmllint: Remove --testIO option
2025-04-18 23:38:48 +02:00
Nick Wellnhofer
95ffa8d234
xmllint: Remove --debugent option
2025-04-18 23:38:48 +02:00
Nick Wellnhofer
7d33f97f65
xmllint: Separate XML and HTML parser options
2025-04-18 23:38:48 +02:00
Nick Wellnhofer
7e1c2b9485
xmllint: Return error code instead of exiting in parseInteger
2025-04-18 18:48:25 +02:00
Nick Wellnhofer
d8193b7af1
xmllint: Fix parsing of --pretty argument
2025-04-17 21:14:00 +02:00
Nick Wellnhofer
470bec654c
xmllint: Switch to xmlSaveSetIndentString
...
Stop using global xmlTreeIndentString.
2025-04-17 21:14:00 +02:00
Nick Wellnhofer
2e2b4c0f18
xmllint: Use xmlSave API to serialize HTML
2025-04-17 21:14:00 +02:00
Nick Wellnhofer
c132829c10
xmllint: Don't serialize to memory with --memory option
...
This is only useful for debugging.
2025-04-17 20:06:07 +02:00
Nick Wellnhofer
8dbf298cc5
xmllint: Fix harmless memory leaks
...
Fixes #892 .
2025-04-17 20:01:16 +02:00
Nick Wellnhofer
5964fb7c5f
xmllint: Fix --html --sax element callbacks
...
We need the non-namespace callbacks for HTML.
2025-03-30 15:00:28 +02:00
Nick Wellnhofer
b349225952
include: Change some return types from int to enum
...
This also affects some new functions from 2.13.
2025-03-14 02:31:01 +01:00
Nick Wellnhofer
fd1b939168
include: Convert some macros to enums
2025-03-14 00:35:40 +01:00
Nick Wellnhofer
d83ff954af
xmllint: Make sure that parser options are used
2025-03-11 16:34:30 +01:00
Nick Wellnhofer
e50d314a27
build: Add separate configuration option for RELAX NG
...
Support for RELAX NG used to be enabled together with XML Schema support
(--with-schemas). Now there's a separate option and a new feature macro
LIBXML_RELAXNG_ENABLED.
2025-03-01 15:18:20 +01:00
Nick Wellnhofer
ce1b704e33
doc: Regenerate libxml2-api.xml
2025-02-25 20:09:36 +01:00
Nick Wellnhofer
25ae533b3e
xmllint: Fix SIGBUS with --memory option
...
If the input file size is a multiple of page size, the byte after the
file's content is on a new page and accessing it will lead to SIGBUS.
Remove XML_INPUT_BUF_ZERO_TERMINATED hint for mmapped files.
Regressed with a221cd78.
Fixes #864 .
2025-02-17 11:45:16 +01:00
Nick Wellnhofer
53a48468ae
xmllint: Make --push report parse errors
...
The push parser leaves documents in ctxt->myDoc even if they're invalid.
Also fix documentation.
Regressed with f8ff4d86.
2025-01-31 15:50:00 +01:00
Nick Wellnhofer
1082d813e8
parser: Prepare to make decompression opt-in
...
Add a new parser option XML_PARSE_UNZIP that enables decompression.
xmlReadFile, xmlCtxtReadFile and xmlCreateURLParserCtxt always set
this option currently, but downstream users should start to set the
option if they really need it.
2025-01-29 00:49:57 +01:00
Nick Wellnhofer
a78843be5e
xmllint: Support compressed input from stdin
...
Another regression related to reading from stdin.
Making a "-" filename read from stdin was deeply baked into the core
IO code but is inherently insecure. I really want to reenable this
dangerous feature as sparingly as possible.
This now enables compressed input when using the "Fd" API functions
which wan't supported before. But XML_PARSE_NO_UNZIP will be
inverted later.
Allow compressed stdin in xmlReadFile to support xmlstarlet and older
versions of xsltproc. So far, these are the only known command-line
tools that rely on "-" meaning stdin.
2025-01-28 23:20:37 +01:00
Nick Wellnhofer
e95c4b07ae
fuzz: Also test xmllint --repeat option
2025-01-23 20:30:40 +01:00
Nick Wellnhofer
dc6270d110
xmllint: Fix UAF with --push --repeat
...
Short-lived regression. Fixes #841 .
2025-01-23 20:30:25 +01:00
Nick Wellnhofer
1c82bca6bd
xmllint: Improve error reports from reader
2025-01-17 23:29:30 +01:00
Nick Wellnhofer
16286dea31
xmllint: Fix memory leak in parseAndPrintFile
2025-01-17 23:14:44 +01:00
Nick Wellnhofer
9cfc723cad
xmllint: Always reuse parser context
...
Also move push parsing into parseXml which makes "--sax --push" work.
2025-01-17 21:42:35 +01:00
Nick Wellnhofer
00167cae33
xmllint: Report OOM errors to stderr
...
For the validators, some work still has to be done, but for core
features, xmllint should now report OOM errors reliably.
2025-01-17 20:06:45 +01:00
Nick Wellnhofer
67b738d9a5
fuzz: Check whether xmllint reports malloc failures correctly
...
This relies on xmllint's "maxmem" option.
2025-01-17 20:06:45 +01:00
Nick Wellnhofer
bfe6af2eed
fuzz: Remove hacks to build lint fuzzer
...
Don't include source file directly.
2025-01-17 20:06:45 +01:00
Nick Wellnhofer
bf1d8b9cfb
xmllint: Report malloc failures from parsing patterns
2025-01-17 20:06:45 +01:00
Nick Wellnhofer
255fd5f3f1
xmllint: Store error stream in global state
2025-01-17 20:06:45 +01:00
Nick Wellnhofer
e42ded421c
xmllint: Stop using global variables
...
The only exception is "maxmem". The custom malloc functions don't
support an extra context.
2025-01-17 20:06:45 +01:00
Nick Wellnhofer
d39e5714b0
xmllint: Fix memory leak in parseFile
...
Short-lived regression.
2025-01-17 20:05:56 +01:00
Nick Wellnhofer
0f4d36e055
xmllint: Fix memory leak in error case
2025-01-17 13:13:54 +01:00
Nick Wellnhofer
86401cc3d2
xmllint: Make --shell ignore some other options
...
When the shell should be launched with the --shell option, don't
post-validate, stream or dump the document. Ignore the --repeat option.
2025-01-07 19:10:19 +01:00
Nick Wellnhofer
c0c69cb868
xmllint: Always reuse parser context
...
Simplifies "repeat" logic.
2025-01-07 18:55:35 +01:00
Nick Wellnhofer
a5be2cc303
xmllint: Support --xpath --debug
...
Dump compiled expression if --debug was supplied.
2025-01-06 19:14:28 +01:00
Nick Wellnhofer
f22707f42b
xmllint: Use xmlXPathOrderDocElems for XPath queries
2025-01-06 19:14:21 +01:00
Nick Wellnhofer
169857ad26
xmllint: Check return value of htmlNewParserCtxt
2024-12-13 18:07:03 +01:00
Nick Wellnhofer
1dc5e50a8e
catalog: Only use XML_SYSCONFDIR if catalogs are enabled
2024-11-21 23:43:23 +01:00
Nick Wellnhofer
a5764b56d2
build: Define XML_SYSCONFDIR in config.h
...
Rename SYSCONFDIR macro to XML_SYSCONFDIR.
Use AX_RECURSIVE_EVAL with Autotools. This is GPL v2 with Autoconf
exception which shouldn't be a problem.
Finally support meson.
2024-11-21 22:44:02 +01:00
Nick Wellnhofer
a4c16a140c
xmllint: Improve --memory and --testIO options
...
Support --memory and --testIO in SAX mode.
Keep memory-mapped file across repetitions.
Options `--sax --memory --noout --repeat` can now be used to benchmark
the core parser without building a DOM tree or repeatedly reading files
from disk.
2024-10-06 20:04:00 +02:00
Nick Wellnhofer
3ac214f01e
xmllint: Support --html --sax
2024-10-06 20:04:00 +02:00
Nick Wellnhofer
d67833a3c5
xmllint: Use proper type to store seconds since epoch
...
Should avoid year 2038 problem.
Fixes #801 .
2024-09-26 19:34:34 +02:00
Nick Wellnhofer
8ad618d2d6
doc: Document all xmllint options
...
Remove --pushsmall.
Fixes #785 .
2024-08-28 22:03:30 +02:00
Nick Wellnhofer
3ef6661175
build: Rework mmap checks
...
Switch to AC_CHECK_DECLS/check_symbol_exists. Don't check for
sys/mman.h separately. Don't check for munmap.
2024-07-22 17:03:27 +02:00