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

5838 Commits

Author SHA1 Message Date
Nick Wellnhofer
1406b20fe9 encoding: Allocate default handlers statically 2022-11-24 19:21:01 +01:00
Sam James
278e7874e6 libxml.m4: fix -Wstrict-prototypes
Signed-off-by: Sam James <sam@gentoo.org>
2022-11-23 11:58:14 +00:00
Chun-wei Fan
707ade225c Visual Studio builds: Allow silencing deprecation warnings
Define XML_IGNORE_DEPRECATION_WARNINGS and the corresponding XML_POP_WARNINGS
for Visual Studio, and consequently define XML_IGNORE_FPTR_CAST_WARNINGS so
that we do not get a compiler warning on Visual Studio by doing a
__pragma(warning(pop)) without a corresponding __pragma(warning(push)).

Also correct the documentation a bit for XML_POP_WARNINGS.
2022-11-23 11:04:38 +08:00
Chun-wei Fan
b9590d5d81 Visual Studio: Define XML_DEPRECATED
We can mark APIs as deprecated using __declspec(deprecated) with Visual Studio
2005 and later, so add a definition of that so that we can help users avoid
using deprecated APIs when using Visual Studio as well.

For the existing GCC definition, check whether we are on GCC 3.1+ before
enabling the definition.
2022-11-23 10:41:08 +08:00
Nick Wellnhofer
b1f9c19383 parser: Fix push parser with unterminated CDATA sections
Short-lived regression found by OSS-Fuzz.
2022-11-22 21:39:01 +01:00
Nick Wellnhofer
97c0a9cff7 tests: Fix use-after-free in Python tests
The nodeset must be freed before the document.

Fixes #443.
2022-11-22 17:01:39 +01:00
Nick Wellnhofer
550345057d Fix .editorconfig 2022-11-22 17:01:21 +01:00
Nick Wellnhofer
34a5a4a5e5 tests: Remove unneeded #includes 2022-11-22 16:03:05 +01:00
Nick Wellnhofer
701beb4ec7 xmllint: Include <io.h> on Windows 2022-11-22 16:03:05 +01:00
Nick Wellnhofer
b9689d1371 gitlab-ci: Make Test-Msvc exit if ctest fails 2022-11-22 16:03:05 +01:00
Nick Wellnhofer
138c897dbf gitlab-ci: Treat compiler warnings as errors on MSVC 2022-11-22 15:49:37 +01:00
Nick Wellnhofer
d725addd92 warnings: Work around MSVC bug
MSVC apparently complains when passing a `const char **` to memset.
Unlike `const char *const *`, this isn't a pointer to const memory.
2022-11-22 15:49:27 +01:00
Chun-wei Fan
cfbe68e468 sources: Silence C4013 warnings on Visual Studio
The read(), close(), open(), lseek() functions are found in io.h on Visual
Studio, which does not ship unistd.h, so include io.h on Windows if unistd.h
is not found.

C4013 (aka implicit declaration of ...) warnings can often ring alarm bells.
2022-11-22 15:20:53 +08:00
Nick Wellnhofer
0e193f0d61 parser: Remove dangerous check in xmlParseCharData
If this check succeeds, xmlParseCharData could be called over and over
again without making progress, resulting in an infinite loop.

It's only important to check for XML_PARSER_EOF which is done later.

Related to #441.
2022-11-21 22:09:19 +01:00
Nick Wellnhofer
94ca36c2c4 parser: Restore parser state in xmlParseCDSect
Fixes #441.
2022-11-21 22:07:11 +01:00
Nick Wellnhofer
a8b31e68c2 parser: Fix progress check when parsing character data
Skip over zero bytes to guarantee progress. Short-lived regression.
2022-11-21 21:39:10 +01:00
Nick Wellnhofer
234915361e Fix .editorconfig 2022-11-21 21:23:44 +01:00
Nick Wellnhofer
c63900fbc1 parser: Check terminate flag when push parsing CDATA sections
Found by OSS-Fuzz.
2022-11-21 20:39:17 +01:00
Nick Wellnhofer
a781ee3395 Revert "parser: Add overflow checks to xmlParseLookup functions"
This reverts commit bfc55d6884.

It's better to fix the root cause.
2022-11-21 20:11:14 +01:00
Nick Wellnhofer
bfc55d6884 parser: Add overflow checks to xmlParseLookup functions
Short-lived regression found by OSS-Fuzz.
2022-11-21 18:29:54 +01:00
Chun-wei Fan
d7e698fca8 python/setup.py.in: Improve Windows import patching
Move up the altImport function so that we ensure that it can be referred
to and streamline it a bit, since we no longer attempt to build the
libxslt Python bits here, at least on Windows.
2022-11-21 12:01:03 +08:00
Nick Wellnhofer
e208eaa27a Add .editorconfig
Fixes #258.
2022-11-20 22:41:51 +01:00
Nick Wellnhofer
9e4a46ace6 parser: Merge misc, prolog and epilog cases in push parser 2022-11-20 22:03:08 +01:00
Nick Wellnhofer
9c63cea5a6 test: Add test for push parser boundaries 2022-11-20 21:27:59 +01:00
Nick Wellnhofer
691a771956 parser: Fix 'consumed' accounting when switching encodings 2022-11-20 21:27:59 +01:00
Nick Wellnhofer
c93679381c html: Fix check for end of comment in push parser
Make sure to reset checkIndex. Handle case where "--" or "--!" is at the
end of the buffer. Fix "avail" check in htmlParseOrTryFinish.
2022-11-20 21:27:59 +01:00
Nick Wellnhofer
55fb8f72ac parser: Fix push parser with 1-3 byte initial chunk
Make sure that ctxt->charset is initialized properly.
2022-11-20 21:27:59 +01:00
Nick Wellnhofer
68a6518c45 parser: Rewrite push parser boundary checks
Remove inaccurate xmlParseCheckTransition check.

Remove non-incremental xmlParseGetLasts check.

Add functions that check for several boundary constructs more
accurately, keeping track of progress in ctxt->checkIndex.

Fixes #439.
2022-11-20 21:27:08 +01:00
Nick Wellnhofer
2059df5358 buf: Deprecate static/immutable buffers 2022-11-20 21:16:03 +01:00
Nick Wellnhofer
1ca0dfec35 reader: Switch to xmlParserInputBufferCreateMem
This is less efficient but can't result in input buffer overreads.

Fixes #326.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
f30adb54f5 uri: Allow port without host
Don't set port to -1 when host is missing. Host can be empty according
to spec.

Fixes #71.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
76d6b0d768 html: Don't escape ASCII chars in href attributes
In several cases, href attributes can contain ASCII characters which are
illegal in URIs. Escaping them often does more harm than good.

Fixes #321.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
4955e0c9e1 io: Don't shrink memory input buffers 2022-11-20 21:16:03 +01:00
Nick Wellnhofer
117bab2256 parser: Don't call xmlSHRINK from push parser
xmlSHRINK also calls xmlParserInputGrow which isn't needed in the push
parser.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
f00739c12e parser: Ignore cdata argument in xmlParseCharData
It never could be used to parse CDATA sections.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
e4f56a7213 parser: Simplify xmlParseConditionalSections 2022-11-20 21:16:03 +01:00
Nick Wellnhofer
3582b07bd2 parser: Fix content parser progress checks
This is another attempt at fixing parser progress checks. Instead of
relying on in->consumed, which could overflow, change some content
parser functions to make guaranteed progress on certain byte sequences.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
f7ad338e09 parser: Fix attribute parser progress checks
This is another attempt at fixing parser progress checks. Instead of
relying on in->consumed, which could overflow, make the attribute parser
functions return a NULL name only if they don't make progress.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
f61b8a6233 parser: Fix DTD parser progress checks
This is another attempt at fixing parser progress checks. Instead of
relying on in->consumed, which could overflow, change some DTD parser
functions to make guaranteed progress on certain byte sequences.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
249cee4b2a io: Fix a few integer overflows in I/O statistics
There are still many places where arithmetic on "consumed" stats isn't
checked for overflow, affecting platforms with a 32-bit long type.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
6b57061909 io: Rearrange code in xmlSwitchInputEncodingInt
No functional change.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
1ef4938fd0 io: Rework xmlParserInputBufferGrow with encodings
Read data directly into the "raw" buffer when converting encodings.
Make sure not to grow memory input buffers.
2022-11-20 21:16:03 +01:00
Nick Wellnhofer
46cd7d224e io: Remove xmlInputReadCallbackNop
In some cases, for example when using encoders, the read callback was
set to NULL, in other cases it was set to xmlInputReadCallbackNop.
xmlGROW only tested for xmlInputReadCallbackNop, resulting in errors
when parsing large encoded content from memory.

Always use a NULL callback for memory buffers to avoid ambiguities.

Fixes #262.
2022-11-20 21:12:18 +01:00
Nick Wellnhofer
9feafbc5c5 io: Check for memory buffer early in xmlParserInputGrow 2022-11-13 18:08:34 +01:00
Nick Wellnhofer
22d879bf0a io: Fix "buffer full" error with certain buffer sizes
Remove a useless check in xmlParserInputBufferGrow that could be
triggered after changing xmlBufAvail in c14cac8b.

Fixes #438.
2022-11-13 15:21:22 +01:00
Nick Wellnhofer
0d1765fdb7 doc: Mention new location of XML catalog as breaking change 2022-11-13 15:21:22 +01:00
Nick Wellnhofer
a249372112 doc: Mention potentially breaking changes in NEWS 2022-11-04 15:10:48 +01:00
Nick Wellnhofer
b693905f9b doc: Remove xmlDllMain from documentation and version script
This is a Windows-only symbol.
2022-11-04 14:50:39 +01:00
Nick Wellnhofer
d48faf1a7d doc: Mention ${sysconfdir} in man pages
Fixes #395.
2022-11-04 14:35:34 +01:00
Nick Wellnhofer
3ab57bf475 doc: Document xmlcatalog --convert
Fixes #417.
2022-11-04 14:35:33 +01:00