1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00
Commit Graph

6695 Commits

Author SHA1 Message Date
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
0bef170486 c14n: Fix memory leak after malloc failure 2024-05-07 17:11:18 +02:00
Nick Wellnhofer
5bfaab77f6 fuzz: Fix reader fuzzer 2024-05-07 17:11:18 +02:00
Nick Wellnhofer
72e9267c32 html: Fix memory leak after malloc failure 2024-05-06 17:40:15 +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
a7854e2646 http: Don't pass NULL pointer as memcpy source 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
d644a23e8f fuzz: Improve xml.dict
- Add standalone declaration
- Add doctype declaration
- Expand ATTLIST matrix in xml.dict
2024-05-06 00:32:08 +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
81611e06da reader: Don't call xmlCtxtErrMemory with NULL ctxt
This can happen in "walker" mode.
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
a4c2b7233f io: Don't set close callback in xmlParserInputBufferCreateFd 2024-05-05 17:27:12 +02:00
Nick Wellnhofer
422ae4623a xmllint: Make some strings const 2024-05-05 17:26:11 +02:00
Nick Wellnhofer
71a7a33e18 parser: Fix base URI of internal parameter entities
Search parent inputs of internal parameter entities for base URI.

Fixes a long-standing bug, which manifested in a different way after
commit 955c177f. Reproduce with

    xmllint --noent xmlconf/eduni/errata-2e/E18.xml
2024-05-03 11:53:45 +02:00
Nick Wellnhofer
fdc5ff3657 parser: Always throw entity errors if external DTD is loaded
When parsing with XML_PARSE_DTDLOAD, missing entities are always an
error.

Also consolidate behavior when validating. See b717abdd.
2024-05-03 11:52:54 +02:00
Nick Wellnhofer
39e5b35bd0 parser: Don't create undeclared entity refs in substitution mode
We never want to create entity reference nodes if entity substitution
is enabled. This also applies to undeclared entities.
2024-05-03 11:46:01 +02:00
Nick Wellnhofer
ae23a4ce56 unicode: Deprecate most xmlUCSIs* functions
These don't seem to be used by downstream code.
2024-04-30 17:42:59 +02:00
Nick Wellnhofer
e637953527 Remove references to old mailing list 2024-04-30 17:00:01 +02:00
Nick Wellnhofer
d2f623d183 reader: Report malloc failure in xmlTextReaderConstValue 2024-04-30 16:36:44 +02:00
Nick Wellnhofer
b8597f46df tree: Handle predefined entities in xmlBufGetEntityRefContent
It's possible to create references to predefined entities using the tree
API. This edge case was exposed by making predefined entities const in
commit 63ce5f9a.
2024-04-30 16:05:42 +02:00
Nick Wellnhofer
619e2808b5 tree: Don't call xmlNewCharRef in xmlNodeParseContent
xmlNewCharRef also tries to handle strings like '&name;' but in
xmlNodeParseContentInternal, we really want to use the possibly invalid
name without modification. Otherwise, content like '&"' could
create a reference to a predefined entity.
2024-04-30 15:53:08 +02:00
Tomáš Ženčák
ae960cac96 Allow unlimited length decimals, integers etc. 2024-04-30 12:33:47 +02:00
Nick Wellnhofer
bffef46c4c doc: Don't install example code 2024-04-28 22:58:06 +02:00
Nick Wellnhofer
5f75c9560f doc: Remove tutorial
The tutorial was moved to the Wiki:

https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Tutorial
2024-04-28 22:57:02 +02:00
Nick Wellnhofer
d381e5de4a doc: Move doc/examples to example 2024-04-28 21:55:34 +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
05654cfe00 html: Deprecate htmlHandleOmittedElem 2024-04-28 18:58:27 +02:00
Nick Wellnhofer
63ce5f9aed Make some globals const 2024-04-28 17:53:39 +02:00
Nick Wellnhofer
577fb0e380 xinclude: Report malloc failure in xmlXIncludeMergeEntities 2024-04-27 16:31:01 +02:00
Nick Wellnhofer
68e440eec4 fuzz: Use all test directories for XML seed corpus
It's probably better to add as many files as possible to the seed corpus
even if they're less specific to a fuzzer.
2024-04-24 22:52:06 +02:00
Nick Wellnhofer
651465f98c test: Remove unused test files 2024-04-24 22:50:53 +02:00
Nick Wellnhofer
0977d7a3af fuzz: Build with compression support on OSS-Fuzz 2024-04-23 22:39:53 +02:00
Nick Wellnhofer
510c7988e0 fuzz: Remove reader pass from XML fuzzers
The reader API is fuzzed separately now.
2024-04-23 18:43:12 +02:00
Nick Wellnhofer
6641a7e824 fuzz: Enable reader fuzzer on OSS-Fuzz 2024-04-23 18:36:15 +02:00
Nick Wellnhofer
45fe9924f0 parser: Don't create reference in xmlLookupGeneralEntity
This should only be done in xmlParseReference.

The handling of undeclared entities is still somewhat inconsistent. In
element content we create references even if entity substitution is
enabled. In attribute values undeclared entities are always ignored.
2024-04-23 18:36:15 +02:00
Nick Wellnhofer
b717abdd09 parser: Consolidate error handling for undeclared entities
Always use XML_WAR_UNDECLARED_ENTITY with warning error level in
documents with external subset or parameter entities. Use
XML_ERR_UNDECLARED_ENTITY otherwise.
2024-04-23 18:36:15 +02:00
Nick Wellnhofer
00336f0fee cmake: Don't use tabs in CMakeLists.txt
Always use spaces and indent_size=4 except for Makefiles.
2024-04-23 18:16:03 +02:00
Nick Wellnhofer
b62ccf7f10 fuzz: Add fuzzer for XML reader API 2024-04-22 12:44:12 +02:00
Nick Wellnhofer
087a346448 xinclude: Increase error count in xmlXIncludeErrMemory 2024-04-22 12:44:12 +02:00
Nick Wellnhofer
7cbf609ae8 reader: Make xmlTextReaderReadString non-recursive
Also report malloc failures.

Fixes #607.
2024-04-22 12:44:12 +02:00
Nick Wellnhofer
f69647811c reader: Rework xmlTextReaderRead{Inner,Outer}Xml
Use an xmlOutputBuffer. Report malloc failures.
2024-04-22 12:44:12 +02:00
Nick Wellnhofer
cdb3103ba8 reader: Report malloc failures 2024-04-22 12:44:12 +02:00
Nick Wellnhofer
d2daf33e33 reader: Fix preservation of attributes
Don't use 'curnode' which might be an attribute or namespace node
which doesn't have an 'extra' member.
2024-04-22 12:44:12 +02:00