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

635 Commits

Author SHA1 Message Date
Nick Wellnhofer
77700d3d0a doc: Mention tree API bugs in old versions 2025-07-31 14:23:23 +02:00
Nick Wellnhofer
c5e7ff09b2 tree: More xmlNodeParseContent cleanup
- Rename to xmlNodeParseAttValue
- Rework argument types
- Remove wrapper function
2025-07-31 14:23:23 +02:00
Nick Wellnhofer
e117405749 tree: Don't reference recursive entities in xmlNodeParseContent
Improve protection against entity cycles when using tree API.
2025-07-20 13:10:15 +02:00
Nick Wellnhofer
3773bb3f89 tree: Make sure that SIZE_MAX is defined 2025-07-09 16:09:56 +02:00
Nick Wellnhofer
ad0f5d27c4 tree: Fix xmlGetNodePath
- Fix quadratic behavior
- Don't truncate names

Fixes #715.
2025-06-24 13:57:20 +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
ad346c9a24 tree: Fix integer overflow in xmlBuildQName
This issue affects memory safety and might receive a CVE ID later.

Fixes #926.
2025-05-27 20:03:13 +02:00
Nick Wellnhofer
7008740a96 parser: Consolidate scanning of XML Names
Use new productions by default.

Fixes #194.
Fixes #364.
See #707.
2025-05-19 19:58:33 +02:00
Nick Wellnhofer
c5b45fbc07 doc: Misc fixes 2025-05-16 19:04:20 +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
777e2adf77 io: Consolidate escaping code
Use generated table approach of xmlSerializeText for xmlEscapeText.

Move most code to xmlIO.c.
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
dad1163078 entities: Always replace invalid chars when escaping
The previous refactor painstakingly recreated the different behavior of
separate functions that were merged. It makes

Optimize IS_CHAR check for non-ASCII chars.
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
971038e59f html: Call lower-level escaping functions
Removes the need to pass a document around.
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
63535d3922 tree: Make xmlNodeListGetStringInternal work with escape flags 2025-05-11 20:29:25 +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
98a61c9dff doc: Fix briefs in tree docs 2025-05-11 20:29:25 +02:00
Nick Wellnhofer
9aaa52fe48 tree: Make xmlNodeAddContent work with attributes 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
e6cfd04994 doc: Misc fixes to tree docs 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
e525564f65 doc: Remove empty lines at start of block
These lines were left over after automatic conversion.
2025-05-02 11:42:05 +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
dd4c0f62fa tree: Fix xmlTextMerge with NULL args
Restore pre-2.13 behavior. Fixes #875.
2025-03-18 11:11:20 +01:00
Nick Wellnhofer
6ab430ca2e Remove unnecessary #includes 2025-02-22 21:55:58 +01:00
Nick Wellnhofer
9c16a153d8 Revert "include: Make most IS_* macros private"
This reverts commit 84a6c82ff8.
2025-02-13 20:20:17 +01:00
Grzegorz Szymaszek
9d7bbf1952 tree: Fix variable name in xmlAddChild documentation 2025-01-23 17:49:54 +00:00
Nick Wellnhofer
ca81916023 include: Use intptr_t to cast between pointers and ints 2025-01-03 20:59:10 +01:00
Nick Wellnhofer
84a6c82ff8 include: Make most IS_* macros private
Macros like IS_DIGIT or IS_LETTER severely pollute the C namespace.
2024-12-21 20:01:30 +01:00
Nick Wellnhofer
2042090b45 tree: Check reallocations for overflow 2024-12-21 19:37:38 +01: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
5d36664fc9 memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
888f70c77e buf: Move xmlBuffer code to buf.c 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
8d1606265d entities: Rework text escaping 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
de3221b179 fuzz: Adjust for xmlNodeParseContent changes
xmlStringGetNodeList returns NULL again for empty strings.
2024-07-06 15:33:06 +02:00
Nick Wellnhofer
944cc23c84 tree: Fix handling of empty strings in xmlNodeParseContent
We shouldn't create an empty text node to match the old behavior.

Fixes #759.
2024-07-03 16:07:10 +02:00
Nick Wellnhofer
842a044831 valid: Restore ID lookup
Revert a change from d025cfbb and don't overwrite ID table entries, so
that the first attribute will be returned if there are duplicate IDs.

This requires two other changes:

- Attributes in entity content are never added to the ID table. This
  seems reasonable.

- Remove the optimization to skip ID lookup when copying and the target
  document has an empty ID table. This also seems more correct since the
  document could have ID declarations nevertheless or we could be
  copying xml:ids into the document for the first time.

Fixes #757.
2024-07-03 11:46:06 +02:00
Nick Wellnhofer
f505dcaea0 tree: Remove underscores from xmlRegisterCallbacks 2024-06-27 14:45:35 +02:00
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
2f12809612 tree: Fix freeing entities via xmlFreeNode
Call xmlFreeEntity to free all entity members.

Fixes #731.
2024-06-14 16:44:09 +02:00
Nick Wellnhofer
5198de4b1d fuzz: Make allocation in xmlBuildQName more likely
Limit size of static buffer in fuzzing mode.
2024-05-31 13:42:08 +02:00
Nick Wellnhofer
e75e878e02 doc: Update and fix documentation 2024-05-20 14:23:39 +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