1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00
Commit Graph

161 Commits

Author SHA1 Message Date
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
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
6705f4d28e Remove executable bit from non-executable files 2019-09-16 15:48:59 +02:00
Nick Wellnhofer
8efc5b283c 14:00 is a valid timezone for xs:dateTime
Closes #100
2019-09-13 12:24:23 +02:00
Nick Wellnhofer
e3f1c7f751 Partial fix for comparison of xs:durations
See https://bugzilla.gnome.org/show_bug.cgi?id=777139

Thanks to Zhongyuan Zhou for the initial merge request !34.
2019-08-25 14:12:23 +02:00
Jens Eggerstedt
b3a95d57f2 Fix unsigned int overflow 2019-07-08 12:26:06 +02:00
Nick Wellnhofer
e03f0a199a Fix hash callback signatures
Make sure that all parameters and return values of hash callback
functions exactly match the callback function type. This is required
to pass clang's Control Flow Integrity checks and to allow compilation
to asm.js with Emscripten.

Fixes bug 784861.
2017-11-09 16:42:47 +01:00
J. Peter Mugaas
d2c329a9a4 Fix -Wimplicit-fallthrough warnings
Add "falls through" comments to quench implicit-fallthrough warnings
which are enabled by -Wextra under GCC 7.
2017-10-21 13:49:31 +02:00
Stéphane Michaut
454e397eb7 Porting libxml2 on zOS encoding of code
First set of patches for zOS
- entities.c parser.c tree.c xmlschemas.c xmlschemastypes.c xpath.c xpointer.c:
  ask conversion of code to ISO Latin 1 to avoid having the compiler assume
  EBCDIC codepoint for characters.
- xmlmodule.c: make sure we have support for modules
- xmlIO.c: zOS path names are special avoid dsome of the expectstions from
  Unix/Windows
2017-08-28 14:30:43 +02:00
Patrick Monnerat
90da33cebe Portability to non C99 compliant compilers
OS400 C compiler is not C99 compliant.
It only supports local variable declarations at the beginning of a block.
We loose the const as a result but portability is more important.
2016-05-03 21:37:52 +08:00
Patrick Monnerat
a1dca81df7 xmlschemastypes.c: accept endOfDayFrag Times set to "24:00:00" mean "end of day" and should not cause an error. 2016-05-01 18:43:40 +08:00
Audric Schiltknecht
cad102b861 Do normalize string-based datatype value in RelaxNG facet checking
Original patch is from Jan Pokorný <jpokorny redhat com>
https://mail.gnome.org/archives/xml/2013-November/msg00028.html

Improve it according to reviews and add test files.
2016-04-15 22:41:24 +08:00
Philip Withnall
4ba5d31769 xmlschemastypes: Fix potential array overflow
The year and month need validating before being put into the
MAX_DAYINMONTH macro.

Coverity issue: #60436

https://bugzilla.gnome.org/show_bug.cgi?id=731990
2014-07-26 20:20:11 +08:00
David Kilzer
30cf439efc Check for tmon in _xmlSchemaDateAdd() is incorrect
For https://bugzilla.gnome.org/show_bug.cgi?id=732705
In _xmlSchemaDateAdd(), the check for |tmon| should be the following
since MAX_DAYINMONTH() expects a month in the range [1,12]:

    if (tmon < 1)
	tmon = 1;

Regression introduced in
https://git.gnome.org/browse/libxml2/commit/?id=14b5643947845df089376106517c4f7ba061e4b0
2014-07-14 22:29:56 +08:00
Jan Pokorný
7a7cad6ed4 Fix typos in xmlschemas{,types}.c
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2013-11-30 20:03:52 +08:00
Gaurav
e79226ccdb Type mismatch in xmlschemastypes.c
For https://bugzilla.gnome.org/show_bug.cgi?id=715152
2013-11-28 22:50:57 +08:00
Daniel Veillard
717042d2ae Avoid crash if allocation fails
https://bugzilla.gnome.org/show_bug.cgi?id=704527
xmlSchemaNewValue() may fail on OOM error
2013-07-22 14:28:20 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Nico Weber
aae48e64df Fix a wrong enum type use in Schemas Types 2012-02-29 09:44:35 +08:00
Daniel Veillard
bbcf1275fe Fix a schema type duration comparison overflow
https://bugzilla.gnome.org/show_bug.cgi?id=653724

Based on the fix suggested by Nick Pope <nick@nickpope.me.uk>
but just changing the casts to avoid using long long type
2011-11-10 23:23:10 +08:00
Daniel Veillard
1ea9590046 Small code cleanup on previous patch
suggested by Andrew Nosenko
2010-07-28 14:49:55 +02:00