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
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
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
487ee1d871
[CVE-2025-32415] schemas: Fix heap buffer overflow in xmlSchemaIDCFillNodeTables
...
Don't use local variable which could contain a stale value.
Fixes #890 .
2025-04-17 12:57:56 +02:00
Nick Wellnhofer
9f8484602f
malloc-fail: Fix type confusion in xmlSchemaCheckAGPropsCorrect
...
Attribute groups must be marked as containing references also if an OOM
error occurred. Otherwise, references won't be resolved, leading to type
confusion in xmlSchemaCheckAGPropsCorrect later in the fixup phase.
I'm not sure why xmlSchemaFixupComponents is called at all if an error
occurred. This has lead to similar issues in the past. On the other
hand, continuing in the presence of errors helps when fuzzing.
See #344 .
2025-03-09 13:53:13 +01:00
Nick Wellnhofer
7ae8e8ac7d
schemas: Make xmlSchemaDump depend on DEBUG_ENABLED
2025-02-22 21:06:34 +01:00
Nick Wellnhofer
5880a9a6bd
[CVE-2024-56171] Fix use-after-free after xmlSchemaItemListAdd
...
xmlSchemaItemListAdd can reallocate the items array. Update local
variables after adding item in
- xmlSchemaIDCFillNodeTables
- xmlSchemaBubbleIDCNodeTables
Fixes #828 .
2025-02-18 15:07:44 +01:00
Nick Wellnhofer
9c16a153d8
Revert "include: Make most IS_* macros private"
...
This reverts commit 84a6c82ff8
.
2025-02-13 20:20:17 +01:00
Nick Wellnhofer
e41941109d
schemas: Make ValidateStream take a const SAXHandler
2025-01-17 20:05:57 +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
3f0bac4820
malloc-fail: Handle more malloc failures in schema code
...
These issues can only arise after a memory allocation failed.
- WXS_ADD_*: Add NULL check and raise error
- XML_SCHEMA_*: Make macros safe
- xmlSchemaParseUnion: Fix leak, raise error, commit after success to
avoid memory corruption
- xmlSchemaVAddNodeQName: Restore nbItems after partial success,
raise error
- xmlSchemaIDCAcquireTargetList: Raise error
- xmlSchemaXPathProcessHistory: Handle errors
- xmlSchemaIDCFillNodeTables: Fix leak
- xmlSchemaCheckCVCIDCKeyRef: Handle errors
- xmlSchemaVPushText: Reset flag to avoid memory corruption
- xmlSchemaNewValidCtxt: Handle errors
- xmlSchemaVDocWalk: Fix leak
- xmlSchemaInitBasicType: Handle error
- xmlSchemaCleanupTypesInternal: Fix null deref
- xmlSchemaWhiteSpaceReplace: Handle error
- xmlSchemaParseUInt: Handle error
- xmlSchemaValAtomicType: Fix leak, handle error
- xmlSchemaDateNormalize: Fix leak
2024-12-21 19:41:16 +01:00
Nick Wellnhofer
db8cce3d27
schemas: Check reallocations for overflow
2024-12-21 19:37:38 +01:00
Nick Wellnhofer
0f4f89005d
parser: Rename inputPush to xmlCtxtPushInput
2024-11-19 00:25:23 +01:00
Nick Wellnhofer
5d36664fc9
memory: Deprecate xmlGcMemSetup
2024-07-16 17:42:10 +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
Rosen Penev
217e9b7af2
clang-tidy: don't return in void functions
...
Found with readability-redundant-control-flow
Signed-off-by: Rosen Penev <rosenp@gmail.com >
2024-06-20 20:37:34 +00:00
Nick Wellnhofer
ef8dc4f673
schemas: Add callbacks for resource loader
2024-06-12 16:36:12 +02:00
Nick Wellnhofer
869f72442a
schemas: Fix ADD_ANNOTATION
...
Fix adding multiple annotations.
2024-03-17 16:14:04 +01:00
Nick Wellnhofer
d0d6174e81
valid: Rework xmlAddID
2024-03-15 19:47:07 +01:00
Benjamin Gilbert
653ef99902
schemas: fix spurious warning about truncated snprintf output
...
Fix warning:
xmlschemas.c: In function 'xmlSchemaVAttributesComplex':
xmlschemas.c:25506:63: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
xmlschemas.c:25506:29: note: 'snprintf' output between 3 and 13 bytes into a destination of size 12
On my system (GCC 13.2.1 x86_64) the warning only appears with -O0.
counter can't exceed 1000, so there's no real bug.
2024-03-02 17:03:28 +09:00
Nick Wellnhofer
c8f1f4a280
doc: Improve documentation of error handlers
2023-12-21 17:36:17 +01:00
Nick Wellnhofer
531d06add6
error: Stop printing some errors by default
...
Unfortunately, it's long-standing behavior for libxml2 to print all
reported errors to stderr by default. This default behavior is now
partially disabled. If no error handler is set, only parser and
validation errors are passed to a generic error handler or printed to
stderr. Other errors are still available via xmlGetLastError and can be
captured with a structured error handler.
2023-12-21 15:02:24 +01:00
Nick Wellnhofer
06c00f6582
schemas: Improve error handling
...
Introduce xmlSchema*ErrFull which checks for memory allocation failures
during error reporting.
Remove arguments from memory error handlers.
Use xmlRaiseMemoryError.
Remove TODO macro.
2023-12-21 02:46:27 +01:00
Nick Wellnhofer
da703eaaea
schemas: Fix reallocation in xmlSchemaXPathProcessHistory
...
See #614 .
2023-11-05 02:03:05 +01:00
Nick Wellnhofer
45470611b0
error: Make xmlGetLastError return a const error
...
This is a slight break of the API, but users really shouldn't modify the
global error struct. The goal is to make xmlLastError use static buffers
for its strings eventually. This should warn people if they're abusing
the struct.
2023-09-22 13:29:07 +02:00
Nick Wellnhofer
4e1c13ebfd
debug: Remove debugging code
...
This is barely useful these days and only clutters the code base.
2023-09-19 17:35:09 +02:00
Nick Wellnhofer
90d5b79958
schemas: Fix memory leak of annotations in notations
...
Found by OSS-Fuzz.
2023-09-14 15:30:38 +02:00
Nick Wellnhofer
d88763ccad
schemas: Fix filename in xmlSchemaValidateFile
...
Make sure that filename appears in error messages.
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
165f3436fc
schemas: Fix line numbers in streaming validation
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
57d88da675
schemas: Fix memory leak in xmlSchemaValidateStream
...
Regressed in 9a82b94a
.
Fixes #530 .
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
e4f85f1bd2
[CVE-2023-28484] Fix null deref in xmlSchemaFixupComplexType
...
Fix a null pointer dereference when parsing (invalid) XML schemas.
Thanks to Robby Simpson for the report!
Fixes #491 .
2023-04-11 14:29:50 +02:00
Nick Wellnhofer
f8efa589e8
malloc-fail: Handle malloc failures in xmlSchemaInitTypes
...
Note that this changes the return value of public function
xmlSchemaInitTypes from void to int. This shouldn't break the ABI on
most platforms.
Found when investigating #500 .
2023-03-14 15:14:38 +01:00
Nick Wellnhofer
73bd5d52ae
malloc-fail: Fix type confusion after xmlSchemaFixupTypeAttributeUses
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:49 +01:00
Nick Wellnhofer
767ae50bc9
malloc-fail: Fix null deref after xmlSchemaItemList{Add,Insert}
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:49 +01:00
Nick Wellnhofer
961a4f35bf
malloc-fail: Fix memory leak in xmlSchemaParseUnion
...
Also report malloc failure from xmlStrndup.
Found with libFuzzer, see #344 .
2023-03-08 13:17:49 +01:00
Nick Wellnhofer
260d6b8d77
malloc-fail: Fix another memory leak in xmlSchemaBucketCreate
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:48 +01:00
Nick Wellnhofer
31844c74df
malloc-fail: Fix null deref in xmlSchemaParseUnion
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:48 +01:00
Nick Wellnhofer
9afb6c5fb8
malloc-fail: Fix memory leak in WXS_ADD_{LOCAL,GLOBAL}
...
It's somewhat dangerous to add the cleanup code to a macro, but
otherwise we'd have to fix all the call sites.
Found with libFuzzer, see #344 .
2023-03-08 13:17:48 +01:00
Nick Wellnhofer
a5787229e5
malloc-fail: Fix memory leak in xmlSchemaBucketCreate
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:48 +01:00
Nick Wellnhofer
e15838ab54
malloc-fail: Fix null deref in xmlSchemaParseWildcardNs
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:48 +01:00
Nick Wellnhofer
ba290a8663
malloc-fail: Fix memory leak in xmlSchemaItemListAddSize
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:47 +01:00