Daniel P. Berrangé
80798c406c
xmlschemastypes: ensure thread safe global initialization
...
Relying on a plain integer flag, with no synchronization primitives does
not give thread-safe initialization. All reads & writes of the
xmlSchemaTypesInitialized flag need to be protected by a mutex to ensure
suitable memory barriers & thus correct ordering wrt any speculative
execution.
A separate internal initializer tied to xmlParserInit is used to create
the mutex used for synchronization, similarly to how catalog.c works.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com >
2025-06-26 17:46:01 +01:00
Nick Wellnhofer
22246f21c5
schemas: Fix compilation with pre-C99 MSVC
...
Regressed with f307237e
.
Fixes #944 .
2025-06-23 23:03:02 +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
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
2d83a84ca6
doc: Misc improvements
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
967df734c5
malloc-fail: Handle malloc failure in xmlSchemaCopyValue
...
Avoid null pointer dereference. Fixes #905 .
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
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
Himanshibansal
fe7f835f32
Fix C4296 warning: Resolve comparison of unsigned int with 0
2025-02-20 10:24:50 +00: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
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
5d36664fc9
memory: Deprecate xmlGcMemSetup
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
1b6403583b
schemas: Stop using xmlValidateNotationUse
...
Simplify symbol availability logic.
2024-06-16 18:47:12 +02:00
Nick Wellnhofer
f307237e14
schemas: Use private copy of global NaN and Inf
...
Simplify symbol availability logic.
2024-06-16 18:47:12 +02:00
Tomáš Ženčák
ae960cac96
Allow unlimited length decimals, integers etc.
2024-04-30 12:33:47 +02:00
Nick Wellnhofer
d0d6174e81
valid: Rework xmlAddID
2024-03-15 19:47:07 +01:00
Maks Mishin
25afd931fc
xmlschemastypes: Remove unreachable if statement
...
Pointer `cur` is created by `value` variable and there is no
need to check `cur` for NULL because of `value` is checked
in the beginning of function.
Found by RASU JSC.
2024-02-29 12:06:43 +00: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
makise-homura
595c19a592
Avoid EDG -Wtype-limits warnings on unsigned comparisons with zero by conversion from unsigned int to int
2023-11-22 05:34:56 +00:00
Nick Wellnhofer
9b5cce7a71
include: Remove more unnecessary includes
2023-09-21 01:50:53 +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
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
19b197b616
malloc-fail: Fix null deref after xmlSchemaCompareDates
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:49 +01:00
Nick Wellnhofer
7762e8eda1
malloc-fail: Fix null deref in xmlSchemaValAtomicType
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:47 +01:00
Nick Wellnhofer
112340c6c0
malloc-fail: Fix null deref in xmlSchemaInitTypes
...
Found with libFuzzer, see #344 .
2023-03-08 13:17:47 +01:00
Nick Wellnhofer
2cac626976
Don't use sizeof(xmlChar) or sizeof(char)
2022-09-01 03:35:19 +02:00
Nick Wellnhofer
0f568c0b73
Consolidate private header files
...
Private functions were previously declared
- in header files in the root directory
- in public headers guarded with IN_LIBXML
- in libxml.h
- redundantly in source files that used them.
Consolidate all private header files in include/private.
2022-08-26 02:11:56 +02:00
Nick Wellnhofer
2070ade6df
Undeprecate schema init functions
...
These functions aren't called from xmlInitParser, so it's better to keep
them public for now.
2022-03-10 01:24:31 +01:00
Nick Wellnhofer
40483d0ce2
Deprecate module init and cleanup functions
...
These functions shouldn't be part of the public API. Most init
functions are only thread-safe when called from xmlInitParser. Global
variables should only be cleaned up by calling xmlCleanupParser.
2022-03-06 15:59:43 +01:00
Damjan Jovanovic
966b0f21c1
Add whitespace folding for some atomic data types that it's missing on.
...
XSD validation fails when some atomic types contain surrounding whitespace
even though XML Schema Part 2: Datatypes Second Edition, section 4.3.6
says they should be collapsed. Fix this.
(I am not sure whether the test is correct.)
Issue: #278
2022-03-02 14:05:51 +00:00
Nick Wellnhofer
776d15d383
Don't check for standard C89 headers
...
Don't check for
- ctype.h
- errno.h
- float.h
- limits.h
- math.h
- signal.h
- stdarg.h
- stdlib.h
- string.h
- time.h
Stop including non-standard headers
- malloc.h
- strings.h
2022-03-02 00:43:54 +01:00
Nick Wellnhofer
346c3a930c
Remove elfgcchack.h
...
The same optimization can be enabled with -fno-semantic-interposition
since GCC 5. clang has always used this option by default.
2022-02-20 21:49:04 +01:00
Nick Wellnhofer
daf2d9c3de
Fix regression in RelaxNG pattern matching
...
XML_SCHEMAS_QNAME is not a string-derived type. Other types up to
XML_SCHEMAS_ENTITIES are.
Should fix #224 .
2022-02-13 23:04:29 +01:00
PaulHiggs
33468d7e70
update for xsd:language type check
...
Fixes #242 .
2021-05-03 18:10:51 +02:00
Xiaoming Ni
cb7a572b3e
xmlschemastypes.c: xmlSchemaGetFacetValueAsULong add, check "facet->val"
...
The xmlSchemaGetFacetValueAsUlong() API is an external API.
The validity of external input parameters must be strictly verified.
Before accessing "facet->val->value", we need check whether "facet->val" is
a null pointer.
Signed-off-by: wuqing <wuqing30@huawei.com >
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
2020-12-07 14:37:55 +01:00
Nick Wellnhofer
8e7c20a1af
Fix integer overflow when comparing schema dates
...
Found by OSS-Fuzz.
2020-08-03 17:35:53 +02:00
Nick Wellnhofer
c0440868c3
Copy xs:duration parser from libexslt
...
The duration parser in libexslt checks for integer overflows.
2020-06-23 16:20:28 +02:00
Nick Wellnhofer
18425d3ad5
Fix integer overflow in _xmlSchemaParseGYear
...
Found with libFuzzer and UBSan.
2020-06-23 16:20:28 +02:00
Nick Wellnhofer
50f18830e1
Fix another memory leak in xmlSchemaValAtomicType
...
Don't collapse language IDs twice.
Found with libFuzzer and ASan.
2020-06-23 16:20:28 +02:00
Nick Wellnhofer
20c60886e4
Fix typos
...
Resolves #133 .
2020-03-08 17:41:53 +01:00
Kevin Puetz
e45e06de90
Fix xmlSchemaGetCanonValue formatting for date and dateTime
...
Per https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation ,
the date portion is supposed to use '-' as the delimiter
2020-02-11 11:35:46 +01:00
Nick Wellnhofer
5eeb9d5fbb
Fix memory leak in xmlSchemaValAtomicType
...
Don't collapse anyUris twice.
Closes #104 .
2019-10-14 16:35:00 +02:00