1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-13 20:58:16 +03:00

5184 Commits

Author SHA1 Message Date
Nick Wellnhofer
a075d256fd Release v2.9.13 v2.9.13 2022-02-19 19:26:42 +01:00
Nick Wellnhofer
04d4124c15 Update news and rebuild documentation 2022-02-19 19:26:42 +01:00
Nick Wellnhofer
652dd12a85 [CVE-2022-23308] Use-after-free of ID and IDREF attributes
If a document is parsed with XML_PARSE_DTDVALID and without
XML_PARSE_NOENT, the value of ID attributes has to be normalized after
potentially expanding entities in xmlRemoveID. Otherwise, later calls
to xmlGetID can return a pointer to previously freed memory.

ID attributes which are empty or contain only whitespace after
entity expansion are affected in a similar way. This is fixed by
not storing such attributes in the ID table.

The test to detect streaming mode when validating against a DTD was
broken. In connection with the defects above, this could result in a
use-after-free when using the xmlReader interface with validation.
Fix detection of streaming mode to avoid similar issues. (This changes
the expected result of a test case. But as far as I can tell, using the
XML reader with XIncludes referencing the root document never worked
properly, anyway.)

All of these issues can result in denial of service. Using xmlReader
with validation could result in disclosure of memory via the error
channel, typically stderr. The security impact of xmlGetID returning
a pointer to freed memory depends on the application. The typical use
case of calling xmlGetID on an unmodified document is not affected.
2022-02-19 19:26:42 +01:00
Nick Wellnhofer
d19bab68f4 Fix fuzz/.gitignore after fixing VPATH build 2022-02-19 19:26:42 +01:00
Nick Wellnhofer
f2ad86fa60 Remove SVN keyword anchors 2022-02-17 19:05:26 +01:00
Nick Wellnhofer
b041d829a2 Remove xmlwin32version.h
This file was undocumented and never used anywhere. Maybe users were
supposed to rename this file to xmlversion.h manually. These days, both
CMake and win32/configure.js generate xmlversion.h from xmlversion.h.in,
just like the Autotools build.
2022-02-16 19:55:30 +01:00
Nick Wellnhofer
176115c664 Fix source URL in libxml.spec.in 2022-02-14 22:49:04 +01:00
Nick Wellnhofer
8626648790 Fix fuzzer test with VPATH build
Also fixes make distcheck.
2022-02-14 18:06:38 +01:00
Nick Wellnhofer
85a35ba068 Support custom prefix when installing Python module
Also fixes make distcheck.
2022-02-14 17:44:29 +01:00
Nick Wellnhofer
4608443695 Remove Makefile.win
A Makefile for Visual C++ 5.0, last changed 23 years ago.
2022-02-14 03:45:03 +01:00
Nick Wellnhofer
a20a6022e0 Fix distribution after README change 2022-02-14 03:45:03 +01:00
Nick Wellnhofer
411f98039e Rework README
- Merge INSTALL.libxml2, CONTRIBUTING and AUTHORS into README
- Convert to Markdown
- Redact and update content
- Update links
2022-02-14 03:00:09 +01:00
Nick Wellnhofer
e16d729d9d Remove README.cvs-commits 2022-02-14 02:33:58 +01:00
Nick Wellnhofer
8eb0693746 Remove outdated ChangeLog code
The ChangeLog is from pre-Git times.
2022-02-14 01:01:23 +01:00
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