1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-27 14:03:36 +03:00

5170 Commits

Author SHA1 Message Date
Nick Wellnhofer
7fe9addcbc Remove CVS and SVN-related code 2022-02-13 23:35:18 +01:00
Nick Wellnhofer
1089111142 Redirect links to xmlsoft.org
Documentation and releases are now available on gitlab.gnome.org.
2022-02-13 23:10:00 +01:00
Nick Wellnhofer
4f2693a1ef Remove README.docs
This was just a partial copy of the main README.
2022-02-13 23:10:00 +01:00
Nick Wellnhofer
4a0c0e63a3 Remove MAINTAINERS
Maintainers are listed in libxml2.doap.
2022-02-13 23:10:00 +01:00
Nick Wellnhofer
b0e6eb97d9 Remove xmltutorial.pdf
We already have an HTML version.
2022-02-13 23:10:00 +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
Nick Wellnhofer
d54564ea00 Remove .travis.yml 2022-02-12 21:38:19 +01:00
Nick Wellnhofer
0a6a79b218 Try again to only build GitLab Pages on main repo 2022-02-12 21:36:27 +01:00
Nick Wellnhofer
a3aca20316 Try again to only build GitLab Pages on main repo 2022-02-12 21:33:53 +01:00
Nick Wellnhofer
15111c82c2 Only build GitLab Pages on main repo 2022-02-12 21:25:25 +01:00
Nick Wellnhofer
2017cae6df Upload documentation to GitLab pages 2022-02-12 20:04:48 +01:00
Nick Wellnhofer
be889b6581 Make xmlFuzzReadString return a zero size in error case
Avoids use of uninitialized memory.
2022-02-12 15:54:54 +01:00
Nick Wellnhofer
57b3abd592 Fix xmlSetTreeDoc with entity references
The children member of entity reference nodes points to the entity
declaration and must never be followed when traversing a tree. In
the worst case, this could lead to an infinite loop.

It's somewhat unclear how moving entity references to other documents
should work exactly. For now we simply set the children pointer to NULL
to avoid a reference to the original document.

Fixes #42.
2022-02-07 22:18:27 +01:00
Nick Wellnhofer
8be44aeb16 Fix "xmllint -"
Short-lived regression from commit d12be00d.
2022-02-07 20:54:33 +01:00
Nick Wellnhofer
9edc20c154 Fix double counting of CRLF in comments
Fixes #151.
2022-02-07 20:54:07 +01:00
Nick Wellnhofer
b14649e397 Remove old ChangeLog
This was probably generated from SVN until 2009. Changes are now
tracked in NEWS.

Fixes #261.
2022-02-07 19:54:20 +01:00
Nick Wellnhofer
fcd4c5b824 Document how to escape XML_CATALOG_FILES
Fixes #309.
2022-02-07 19:22:45 +01:00
Nick Wellnhofer
ea53fc18bc Properly handle nested documents in xmlFreeNode
Client code should never add document nodes as children of other nodes,
but even our own XPointer code has a bug that can produce such trees.
Make sure to really free nested documents. Also see commits 0815302d
and 0762c9b6.

Should fix #269.
2022-02-07 18:36:00 +01:00
Nick Wellnhofer
9653565765 Make sure to grow input buffer in xmlParseMisc
Otherwise, large amount of whitespace could lead to documents not
being parsed correctly.

Fixes #299.
2022-02-07 15:43:36 +01:00
Nick Wellnhofer
9b8ef34dc9 Fix unused function warning in testapi.c 2022-02-04 14:42:16 +01:00
Nick Wellnhofer
d12be00da8 Don't ignore xmllint options after "-"
There's no reason to ignore options after "-". This was probably
confused with the "--" mechanism which xmllint doesn't implement.

Fixes #290.
2022-02-04 14:13:59 +01:00
Nick Wellnhofer
5408c10c37 Don't normalize namespace URIs in XPointer xmlns() scheme
Namespace URIs should be compared without escaping or unescaping:

https://www.w3.org/TR/REC-xml-names/#NSNameComparison

Fixes #289.
2022-02-04 14:00:09 +01:00
Nick Wellnhofer
1c7d91abe4 Fix handling of XSD with empty namespace
An empty namespace means no default namespace.

Fixes #303.
2022-02-03 23:31:19 +01:00
Nick Wellnhofer
f480f7509c Update NewsML DTD in test suite
Switch to version 1.2 which has a clearer license.

Fixes #291.
2022-02-03 14:43:17 +01:00
Nick Wellnhofer
247cfa27cc Fix parsing of xmllint --maxmem option
Fixes #195.
2022-02-01 16:38:29 +01:00
Nick Wellnhofer
96dc7f4ae6 Also register HTML document nodes
Fixes #196.
2022-02-01 16:38:29 +01:00
Nick Wellnhofer
18d1f9d42a Add more checks for malloc failures in xmllint.c
Also fix a few of the existing checks.

Fixes #197.
Fixes #198.
2022-02-01 16:38:17 +01:00
Nick Wellnhofer
eab8652216 Make xmllint return an error if arguments are missing
Before, xmllint would only return an error code if the argument
list was completely empty.

Fixes #285.
2022-01-31 14:45:09 +01:00
Nick Wellnhofer
6010a5369f Avoid potential integer overflow in xmlstring.c
For historical reasons, the string API operates with int indices which
can overflow, especially on 64-bit systems. libxml2 always made the
tacit assumption that strings will be never larger than INT_MAX bytes.
It should be considered a bug if any part of the code can produce
larger strings, whether they are externally visible or not.

Likewise, API users are expected not to supply strings larger than
INT_MAX bytes. This requirement isn't documented. But even if it was,
we must handle larger strings passed in by accident without causing
memory errors.

- xmlStrndup, xmlCharStrndup, xmlUTF8Strndup
  Avoid integer overflow if len == INT_MAX.

- xmlStrlen, xmlUTF8Strsize, xmlUTF8Strloc
  Avoid integer overflow by using size_t for index. If an input string
  larger than INT_MAX bytes is detected, these functions now return 0
  instead of a wrong and possibly negative value.

- xmlCheckUTF8
  Avoid integer overflow by limiting index range.

- xmlStrncat, xmlStrncatNew, xmlEscapeFormatString
  Avoid integer overflow. Return NULL instead of producing strings
  larger than INT_MAX bytes.
2022-01-28 16:27:12 +01:00
David Kilzer
8f5ccada05 xmlAddChild() and xmlAddNextSibling() may not attach their second argument
Use the return value of xmlAddChild() and xmlAddNextSibling()
instead of the second argument directly.

Found by OSS-Fuzz.

Fixes #316
2022-01-25 16:30:48 +00:00
Nick Wellnhofer
53983804ce Run CI tests with UBSan implicit-conversion checks
This enables the remaining checks from the "integer" group:

- implicit-unsigned-integer-truncation
- implicit-signed-integer-truncation
- implicit-integer-sign-change

These checks can find all kinds of bugs and only require explicit casts
if integer truncation or sign change is really intended.
2022-01-25 03:20:28 +01:00
Nick Wellnhofer
a647e43025 Fix casting of line numbers in SAX2.c
The line member is an unsigned short. Avoids integer conversion warnings
with UBSan.

Also use USHRT_MAX instead of hard-coded constant.
2022-01-25 03:20:28 +01:00
Nick Wellnhofer
67c2e78b81 Fix integer conversion warnings in hash.c
Use unsigned long for temporary variable to avoid integer conversion
warnings with UBSan.

Note that this does change the computation of hash values for input
bytes larger than 0x7F. Before, these bytes were first converted to a
(typically) signed char with a negative value, then to a large unsigned
long near ULONG_MAX. I doubt that this was intentional. Input bytes
larger than 0x7F are now converted to unsigned long unchanged.
2022-01-25 03:15:12 +01:00
Nick Wellnhofer
21217dd94c Add explicit casts in runtest.c
Avoids integer conversion warnings with UBSan.
2022-01-25 03:07:30 +01:00
Nick Wellnhofer
7abc6e6a24 Fix integer conversion warning in xmlIconvWrapper
Use size_t for return value of iconv(3) to avoid an UBSan integer
conversion warning.
2022-01-25 03:07:30 +01:00
Nick Wellnhofer
f4a74bf0ae Add suffix to unsigned constant in xmlmemory.c
Avoids an integer conversion warning with UBSan.
2022-01-25 03:07:30 +01:00
Nick Wellnhofer
5948abfe99 Add explicit casts in testchar.c
Avoids integer conversion warnings with UBSan.
2022-01-25 01:59:03 +01:00
Nick Wellnhofer
6f95273e44 Fix integer conversion warnings in xmlstring.c
Use an int to avoid an integer conversion warning with UBSan when
left-shifting a char.
2022-01-25 01:53:43 +01:00
Nick Wellnhofer
0596d67ddc Add explicit cast in xmlURIUnescapeString
Avoids an integer conversion warning with UBSan.
2022-01-25 01:39:41 +01:00
Nick Wellnhofer
f872aa1807 Fix handling of ctxt->base in xmlXPtrEvalXPtrPart
Also set ctxt->base when updating ctxt->cur. Always restore ctxt->cur
on error. Avoids integer truncation and wrong column numbers in
xmlXPathErr.

Stop hiding modification of ctxt members behind a macro.

Found with UBSan.
2022-01-25 01:16:00 +01:00
Nick Wellnhofer
97fe12791a Remove wrong tarname from AC_INIT
Remove the "tarname" added in commit 7c0253aa. Having a tarname
including a version number would result in tarballs named
libxml2-2.9.12-2.9.12.tar.gz.

This change also means that documentation will now be installed in
$(datadir)/doc/libxml2 instead of $(datadir)/doc/libxml2-$(version).
Having a version number in the documentation directory doesn't seem
helpful. The new location also matches the default autotools $(docdir).
2022-01-20 16:16:52 +01:00
Nick Wellnhofer
00e618eb0a Remove old devhelp format
See #295.
2022-01-17 21:39:27 +01:00
Nick Wellnhofer
d85245f934 Fix regression with PEs in external DTD
Fix a regression introduced with commit a28f7d87. In some cases,
parameter entity references in external DTDs wouldn't be expanded.

Fixes #306.
2022-01-16 21:56:10 +01:00
Nick Wellnhofer
9f4cb84c62 Fix xmllint --maxmem
xmlMemSetup must be called before initializing the parser, otherwise
some data structures will be allocated with system malloc instead of
our custom allocator. This throws off built-in memory debugging and
sanitizers.
2022-01-16 18:41:58 +01:00
huangduirong
e4c91f7473 Fix Null-deref-in-xmlSchemaGetComponentTargetNs 2022-01-16 16:24:47 +01:00
Nick Wellnhofer
9277abe25b Fix libxml2.doap
Add description.

Change category to "infrastructure". Apparently, "platform" isn't
allowed anymore.

Add programming language.
2022-01-16 16:01:28 +01:00
Finn Barber
87a9927042 Added regression tests for xmlReadFd() and htmlReadFd() 2022-01-16 15:32:45 +01:00
Finn Barber
fe6890e292 Fix htmlReadFd, which was using a mix of xml and html context functions 2022-01-16 15:31:54 +01:00
Nick Wellnhofer
67953a9f11 Fix memory leak in xmlXPathCompNodeTest
Found by Coverity.
2022-01-16 15:30:02 +01:00
Chun-wei Fan
3cc64a88d4 setup.py.in: Try to import setuptools
This way, we can build binary wheels easily if needed
2022-01-16 15:18:06 +01:00