Nick Wellnhofer
2a713a8091
tree: Document behavior if xmlSetTreeDoc fails
2024-03-29 12:57:20 +01:00
Nick Wellnhofer
f1e9c7bdf1
tree: Optimize xmlInsertNode
...
Relink the node directly without calling xmlUnlinkNodeInternal.
2024-03-29 12:57:20 +01:00
Nick Wellnhofer
ea0ee36546
tree: Align xmlAddChild with other node insertion functions
...
Make xmlAddChild unlink the child before insertion. Originally, linked
children would most likely cause tree corruption. The first fix
disallowed linked nodes, but there are cases where insertion of such
nodes could succeed.
Don't abort if the node is already a child of parent. In this case,
the node will be moved to the end of the child list.
2024-03-29 12:57:20 +01:00
Nick Wellnhofer
e5cdb23f10
tree: Introduce xmlUnlinkNodeInternal
...
xmlUnlinkNode also removes references to DTD nodes which shouldn't be
done when moving nodes within a document. Introduce a new function
xmlUnlinkNodeInternal which only unlinks a node from the tree.
Remove references to DTD nodes in xmlNodeSetDoc. Note that moving
element and attribute declarations to another document will still leave
references in the source document.
2024-03-29 12:56:56 +01:00
Nick Wellnhofer
1d50df8768
examples: Don't leave temp files
2024-03-28 12:08:13 +01:00
Nick Wellnhofer
bfb02fbca9
fuzz: Fix xmlSetProp in API fuzzer
...
Finding the old attribute node is a bit more involved.
2024-03-28 11:30:05 +01:00
Nick Wellnhofer
9bce9dbb19
valid: Report malloc failure in xmlValidateOneElement
2024-03-26 14:30:57 +01:00
Nick Wellnhofer
887ad90a1a
fuzz: Restrict input size of API fuzzer
2024-03-26 14:23:51 +01:00
Nick Wellnhofer
6c5248e2a9
fuzz: Restrict number of copies in API fuzzer
...
Avoid timeouts with large inputs.
2024-03-26 14:21:47 +01:00
Nick Wellnhofer
aa04838eab
html: Use binary search in htmlEntityValueLookup
2024-03-26 14:21:11 +01:00
Nick Wellnhofer
23a81841d2
tree: Work on documentation
2024-03-25 20:51:14 +01:00
Nick Wellnhofer
52efb20a18
fuzz: Enable float-divide-by-zero on OSS-Fuzz
...
This was recently disabled globally:
https://github.com/google/oss-fuzz/pull/11567
2024-03-24 13:43:25 +01:00
Nick Wellnhofer
1ace0e8529
xinclude: Report malloc failure in xmlXIncludeAddNode
2024-03-24 12:28:22 +01:00
Nick Wellnhofer
ad9a5637f9
tree: Fix uninitialized value in xmlSearchNsSafe
...
Short-lived regression.
2024-03-22 19:37:12 +01:00
Nick Wellnhofer
00c2f549e4
ci: Support ASan in Docker container
...
Ubuntu now requires libclang-rt-dev for ASan libraries.
2024-03-22 19:16:47 +01:00
Nick Wellnhofer
0e6e39213a
ci: Show config.log if configuration failed
2024-03-22 18:39:57 +01:00
Nick Wellnhofer
c978a5d8d4
ci: Remove Python 2 job, update C89 job
...
Python 2 isn't supported on newer Ubuntu releases. Newer Python
releases have header files which aren't compatible with C89.
2024-03-22 18:34:12 +01:00
Nick Wellnhofer
3d6a25e530
doc: Update Docker CI instructions
2024-03-22 18:22:20 +01:00
Nick Wellnhofer
e7ff3ca43f
ci: Update Docker container to Ubuntu 23.10
...
This removes Python 2.
2024-03-22 18:09:23 +01:00
Nick Wellnhofer
22455e97f9
ci: Add meson to Docker container
2024-03-22 17:52:35 +01:00
Nick Wellnhofer
d8741b8196
fuzz: Fix namespaces after xmlDOMWrapRemoveNode
2024-03-22 14:55:22 +01:00
Nick Wellnhofer
05c147c3ef
SAX2: Report malloc failure in xmlSAX2AttributeNs
2024-03-22 13:03:37 +01:00
Nick Wellnhofer
0d04d79cd4
xinclude: Report malloc failures in xmlXIncludeIncludeNode
2024-03-22 12:26:28 +01:00
Nick Wellnhofer
7b316c1139
tree: Fix uninitialized value in xmlSearchNsByHrefSafe
...
Short-lived regression.
2024-03-22 12:15:23 +01:00
Nick Wellnhofer
d4d1f3f33d
fuzz: Enable API fuzzer on OSS-Fuzz
2024-03-20 18:45:10 +01:00
Nick Wellnhofer
5ea2970357
fuzz: Reorder API fuzzer ops
2024-03-20 18:41:26 +01:00
Nick Wellnhofer
da32c852a4
fuzz: Check text nodes after merging
...
Avoid exponential growth of text.
2024-03-20 18:33:40 +01:00
Nick Wellnhofer
577e2516d0
valid: Check for NULL node->name in xmlSnprintfElements
...
Unfortunately, we can have NULL element names if xmlSetTreeDoc fails.
2024-03-19 17:06:07 +01:00
Nick Wellnhofer
a279aae30f
io: Allocate output buffer with XML_BUFFER_ALLOC_IO
...
This allows efficient shrinking of memory buffers.
Support IO buffers in xmlBufDetach.
2024-03-18 15:14:43 +01:00
Nick Wellnhofer
072facc49e
encoding: Don't shrink input too early in xmlCharEncOutput
...
Some exotic encodings like ISO646-FR don't support '#' characters, so
encoding a character reference can actually fail. Don't skip the
offending input in this case so the error will be reported on the next
call.
2024-03-18 15:14:43 +01:00
Nick Wellnhofer
3f05508a53
tree: Report malloc failures in attribute setters
2024-03-18 15:14:43 +01:00
Nick Wellnhofer
3bdd0d7b30
xinclude: Set errNo in xmlXIncludeErrMemory
2024-03-18 14:13:15 +01:00
Nick Wellnhofer
6a49bb777c
tree: Introduce xmlSearchNsSafe
...
After the failed experiment with a static XML namespace, introduce
versions of xmlSearchNs that report malloc failures.
Optimize the no-document case by only adding the XML namespace
declaration if it wasn't found in an ancestor.
2024-03-17 21:07:46 +01:00
Nick Wellnhofer
047ea3ecb3
Revert "tree: Allocate XML namespace statically"
...
This reverts commit 2840e33c5e4b51589a0b96e8102638eeaea6df72.
2024-03-17 21:04:40 +01:00
Nick Wellnhofer
fb1e63025b
save: Check for NULL node->name in xhtmlIsEmpty
2024-03-17 19:42:59 +01:00
Nick Wellnhofer
869f72442a
schemas: Fix ADD_ANNOTATION
...
Fix adding multiple annotations.
2024-03-17 16:14:04 +01:00
Nick Wellnhofer
1b4bf22c14
xmlreader: Fix memory leak in xmlTextReaderFreeProp
...
Short-lived regression.
2024-03-17 16:14:04 +01:00
Nick Wellnhofer
dc2a03d482
valid: Deprecate internal validation functions
2024-03-16 15:20:08 +01:00
Nick Wellnhofer
c0edd792ba
fuzz: Move fuzzer options to environment variable
2024-03-16 15:20:08 +01:00
Nick Wellnhofer
55175f7537
fuzz: Add OSS-Fuzz build.sh
...
Move build.sh to our repo to facilitate changes.
2024-03-15 22:07:23 +01:00
Nick Wellnhofer
f14f089fe3
fuzz: Add some comments in api.c
2024-03-15 22:07:23 +01:00
Nick Wellnhofer
ee0c1f87c0
fuzz: New tree API fuzzer
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
2469d5d065
tree: Tighten source doc check in xmlDOMWrapAdoptNode
...
sourceDoc must match even if node->doc is NULL.
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
37556eb32a
tree: Check destParent->doc in xmlDOMWrapCloneNode
...
The document must match destDoc to avoid tree corruption.
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
7c48c01b1c
tree: Switch to xmlNodeSetDoc in xmlDOMWrapAdoptNode
...
Report malloc failures.
Also fixes an issue where xmlDOMWrapAdoptAttr would descend into entity
references.
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
be2c26fb67
tree: Fix tree iteration in xmlDOMWrapRemoveNode
...
We didn't descend into elements having attributes.
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
4a90ce089c
tree: Don't abort early if malloc fails in DOM functions
...
If malloc fails halfway through updating a subtree, we must process the
rest of the tree to avoid tree corruption.
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
ad019ba102
tree: Fix reallocation in xmlDOMWrapNSNormAddNsMapItem2
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
e321eba0c7
tree: Set parent->last early in xmlDOMWrapCloneNode
...
Avoids a corrupted tree in error case.
2024-03-15 19:54:27 +01:00
Nick Wellnhofer
84e6dc9e5b
tree: Declare namespace on clone in xmlDOMWrapCloneNode
...
The new namespace must be declared on the cloned node, not the source
node.
2024-03-15 19:54:27 +01:00