1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00
Commit Graph

273 Commits

Author SHA1 Message Date
Nick Wellnhofer
7cfa3a2650 reader: Remove unused member xinclude_name 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
6a6a46f017 doc: Fix autolink errors
Fix links, remove links to internal functions.
2025-05-28 16:02:41 +02:00
Nick Wellnhofer
7bd8d1d9cc doc: Prefix autolinks with '#'
Use `#func` instead of `func()` to ignore parameters and make all
autolinks work.
2025-05-28 16:01:52 +02:00
Nick Wellnhofer
6f4b452742 parser: Stop using ctxt->linenumbers
I think this was used to avoid setting the `line` member before it was
added (20+ years ago).
2025-05-16 18:03:12 +02:00
Nick Wellnhofer
adfbeb7e08 doc: Stop using *Ptr typedefs in documentation 2025-05-16 18:03:12 +02:00
Nick Wellnhofer
a40f36e7f2 include: Stop using *Ptr typedefs in public headers 2025-05-16 18:03:12 +02:00
Nick Wellnhofer
442c1903af doc: Fix some damage from automated conversions
Add some newlines, fix returns.
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
b3854fe964 reader: Fix null deref on malloc failure
Short-lived regression from 177067ea.
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
9bbffec568 doc: Move brief to top, params to bottom of doc comments 2025-05-06 19:51:38 +02:00
Nick Wellnhofer
cb1635a642 doc: Use @since command 2025-05-02 19:05:25 +02:00
Nick Wellnhofer
e78e05c990 doc: Fix autolinks to functions
Unfortunately, autolinks in .c files aren't converted by Doxygen for
some reason.
2025-05-02 17:45:31 +02:00
Nick Wellnhofer
f7c412874b doc: Remove more comment block headers 2025-05-02 17:41:26 +02:00
Nick Wellnhofer
e549622bc5 doc: Convert documentation to Doxygen
Automated conversion based on a few regexes.
2025-05-01 23:23:42 +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
0bac84b1bd Add missing NULL checks to public API functions 2025-04-25 13:15:29 +02: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
be579a266e reader: Fix return value of xmlTextReaderReadString again
Make sure to return NULL for node types except elements or text to match
the old behavior.

Note that CDATA sections are still treated like text nodes and will have
their content returned.

Fixes #838.
2025-01-15 15:24:58 +01:00
Nick Wellnhofer
58e2e72481 reader: Check reallocations for overflow 2024-12-21 19:37:37 +01:00
Nick Wellnhofer
e6045ed754 reader: Add argument checks 2024-12-13 12:39:52 +01:00
Nick Wellnhofer
49164610a4 reader: Forward catastrophic errors from XInclude 2024-12-13 12:39:44 +01:00
Nick Wellnhofer
0f4f89005d parser: Rename inputPush to xmlCtxtPushInput 2024-11-19 00:25:23 +01:00
Nick Wellnhofer
9201173c5a xmlreader: Fix return value of xmlTextReaderReadString
Return NULL if the node has no children or the children were already
deleted to match the 2.12 behavior.

Fixes #817.
2024-11-05 11:41:28 +01:00
Nick Wellnhofer
b7c0f9d2dd string: Fix va_copy fallback
Fix va_copy fallback reworked in 5cffba83.

Should fix #812.
2024-10-19 14:53:25 +02:00
Nick Wellnhofer
0c56eb8215 tree: Restore return value of xmlNodeListGetString with NULL list
When passing a NULL list to xmlNodeListGetString or
xmlNodeListGetRawString, return NULL instead of "" to match the old
behavior.

Fixes #783.
2024-08-12 21:38:50 +02:00
Nick Wellnhofer
92f30711de parser: Optimize buffer shrinking
Remove checks now that we can shrink memory buffers efficiently.

Shrink more aggressively.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
a221cd7849 buf: Rework xmlBuf code
Always use what the old implementation called the "IO" allocation
scheme, allowing to move the content pointer past the initial
allocation. This is inexpensive and allows efficient shrinking.

Optimize xmlBufGrow, reusing shrunken memory as much as possible.

Simplify xmlBufAdd.

Make xmlBufBackToBuffer return an error on overflow.

Make "size" exclude the terminating NULL byte.

Always provide an initial size.

Reintroduce static buffers.

Remove xmlBufResize and several other functions.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
6be79014d7 Remove unused code 2024-07-15 16:33:38 +02:00
Nick Wellnhofer
440d11afd4 reader: Deprecate xmlTextReaderByteConsumed
Document that this function is useless.

Stop trying to handle encoding via xmlByteConsumed which can be
expensive.
2024-07-13 15:42:02 +02:00
Nick Wellnhofer
2e63656ec6 parser: Check return value of inputPush
inputPush typically doesn't fail because we pre-allocate the input
table. The return value should be checked nevertheless.
2024-07-08 11:27:52 +02:00
Nick Wellnhofer
f505dcaea0 tree: Remove underscores from xmlRegisterCallbacks 2024-06-27 14:45:35 +02:00
Nick Wellnhofer
57004006ae reader: Fix xmlTextReaderReadString
Regressed in commit 7cbf609a.

Should fix #738.
2024-06-17 15:49:03 +02:00
Nick Wellnhofer
fd7d9e5eca reader: Add callbacks for resource loader 2024-06-12 16:36:12 +02:00
Nick Wellnhofer
e75e878e02 doc: Update and fix documentation 2024-05-20 14:23:39 +02:00
Nick Wellnhofer
16fb1028a2 reader: Fix error reporting with walker
Abort earlier in xmlTextReaderRead if an error was raised.
2024-05-13 12:50: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
d2f623d183 reader: Report malloc failure in xmlTextReaderConstValue 2024-04-30 16:36:44 +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
Nick Wellnhofer
1b4bf22c14 xmlreader: Fix memory leak in xmlTextReaderFreeProp
Short-lived regression.
2024-03-17 16:14:04 +01:00
Nick Wellnhofer
d0d6174e81 valid: Rework xmlAddID 2024-03-15 19:47:07 +01:00
Nick Wellnhofer
84a71860a8 xmlreader: Fix xmlTextReaderConstEncoding
Regression from commit f1c1f5c6.

Fixes #697.
2024-02-26 15:33:06 +01:00
Nick Wellnhofer
13962b06d5 xmlreader: Clean up error handling
Make sure that xmlTextReaderRead returns -1 immediately if the reader is
in an error state.
2024-02-06 12:56:56 +01:00
Nick Wellnhofer
ddda373eb5 xmlreader: Make xmlTextReaderValidateEntity return an error code
This makes sure that xmlTextReaderRead returns -1 if a memory
allocation fails.
2024-02-06 12:56:56 +01:00
Nick Wellnhofer
1a66b17605 [CVE-2024-25062] xmlreader: Don't expand XIncludes when backtracking
Fixes a use-after-free if XML Reader if used with DTD validation and
XInclude expansion.

Fixes #604.
2024-02-04 15:23:49 +01:00
Nick Wellnhofer
12f0bb9478 parser: Synchronize more options 2024-01-05 20:39:40 +01:00