1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00
Commit Graph

148 Commits

Author SHA1 Message Date
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
Csaba Raduly
5f8f5e7add Fix errors in XSD double validation check
- xmlschemastypes.c: "e" and "E" should not be accespted as is, digits
  are needed
2010-07-28 11:41:23 +02:00
Vincent Lefevre
933e5de96c Bug 565747 – relax anyURI data character checking
* xmlschemastypes.c: anyURI values that contain an apostrophe or a
  space character or any non-ascii char were rejected, this is opposed
  to XSD-1.0 datatype rules
2009-08-07 16:42:24 +02:00
Daniel Veillard
bfc42632b7 horror around the definition of the lexical values for decimal and derived
* xmlschemastypes.c: horror around the definition of the lexical
  values for decimal and derived types, fixing to reject empty 
  values, should fix #503268
Daniel

svn path=/trunk/; revision=3728
2008-04-03 10:43:52 +00:00
Daniel Veillard
26ab0e6c73 applied patch from Mikhail Zabaluev to separate library flags for shared
* libxml-2.0.pc.in: applied patch from Mikhail Zabaluev to separate
  library flags for shared and static builds, fixes #344594. If this
  bites you, use xml2-config.
Daniel
2006-10-11 12:32:51 +00:00
Daniel Veillard
14b5643947 more cleanups based on coverity reports. Daniel
* relaxng.c xmlschemas.c xmlschemastypes.c: more cleanups based
  on coverity reports.
Daniel
2006-03-09 18:41:40 +00:00
Kasimier T. Buchcik
1869be5690 Fixed xs:boolean to reject the empty string (reported by Bas Driessen on
* xmlschemas.c xmlschemastypes.c: Fixed xs:boolean to reject
  the empty string (reported by Bas Driessen on the mailing-list).
  Fixed schema XSI-acquisition and construction: the schemata
  (xmlSchema) didn't get the targetNamespace in some cases, thus
  the component resolution mechanism failed to work. The XSI
  stuff needs to be tested more intensively; think about how
  to test this for regression.
2006-02-20 13:37:55 +00:00
Daniel Veillard
6a0baa0cd8 fixed a number of warnings shown by HP-UX compiler and reported by Rick
* HTMLparser.c configure.in parserInternals.c runsuite.c runtest.c
  testapi.c xmlschemas.c xmlschemastypes.c xmlstring.c: fixed a number
  of warnings shown by HP-UX compiler and reported by Rick Jones
Daniel
2005-12-10 11:11:12 +00:00
Kasimier T. Buchcik
72f50c18d9 Fixed parsing of xs:decimal to allow/deny special lexical forms. Fixed the
* xmlschemastypes.c: Fixed parsing of xs:decimal to
  allow/deny special lexical forms. Fixed the totalDigits
  for values in the range (x < 1) &&  (x > -1) && (x != 0);
  E.g "0.123" has now a totalDigits of 3 (was 4 previously).
  Adjusted the comparison function for decimals due to this
  change. As a side effect comparison against zeroes was
  optimized.
2005-11-28 16:36:30 +00:00
Daniel Veillard
5e9576a492 Albert Chin found another signed/unsigned problem in the date and time
* xmlschemastypes.c: Albert Chin found another signed/unsigned problem
  in the date and time code raised on IRIX 6.5
Daniel
2005-11-21 11:23:47 +00:00
Kasimier T. Buchcik
69dea3a0c0 Fixed the type of the totalDigits value to be positiveInteger. Fixed crash
* xmlschemas.c xmlschemastypes.c: Fixed the type of the
  totalDigits value to be positiveInteger.
  Fixed crash in an error report function when we gave it
  the document node; only element and attribute nodes are
  processed now (reported by Rob Richards).
2005-11-07 14:02:44 +00:00
Daniel Veillard
4f917e2416 applied patch from Kuba Nowakowski fixing bug #313982 also added the test
* xmlschemastypes.c: applied patch from Kuba Nowakowski fixing bug
  #313982
* result/schemas/bug313982* test/schemas/bug313982*: also added
  the test case to the regression suite.
Daniel
2005-08-22 16:01:43 +00:00
Daniel Veillard
9e2110bbff applied patch from Marcus Boerger to remove warnings on Windows. Daniel
* nanoftp.c nanohttp.c xmlschemastypes.c: applied patch from
  Marcus Boerger to remove warnings on Windows.
Daniel
2005-08-08 20:33:54 +00:00
Kasimier T. Buchcik
11162b7ce7 Added creation of the content type of xs:anyType. This is needed when
* xmlschemastypes.c: Added creation of the content type of
  xs:anyType. This is needed when trying to extend xs:anyType
  (although it makes no sense to extend it; IMHO the schema
  people should have ruled this out). This was reported
  by Yong Chen to the mailing list.
* xmlschemas.c: Fixed handling of xs:anyType in
  xmlSchemaCheckCOSCTExtends() (reported by Young Chen). Tiny
  adjustment to an error report output.
* test/schemas/extension2* result/schemas/extension2*:
  Added a test case provided by Young Chen.
2005-07-28 00:50:22 +00:00