1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-15 23:24:06 +03:00

5651 Commits

Author SHA1 Message Date
Nick Wellnhofer
53ab38408d encoding: Make init function private 2022-11-27 02:11:07 +01:00
Nick Wellnhofer
3e9d5e4f7f encoding: Remove unused variable xmlDefaultCharEncodingHandler 2022-11-27 02:11:07 +01:00
Nick Wellnhofer
05c3a458aa tests: Check that xmlInitParser doesn't allocate memory 2022-11-27 02:11:07 +01:00
Nick Wellnhofer
78c0391bc7 parser: Register atexit handler in locked section 2022-11-25 15:12:56 +01:00
Nick Wellnhofer
71931233cd threads: Use __libc_single_threaded if available
Fixes #427
2022-11-25 15:12:56 +01:00
Nick Wellnhofer
c73d464afb threads: Deprecate some internal functions 2022-11-25 15:12:56 +01:00
Nick Wellnhofer
65d381f32c threads: Allocate mutexes statically 2022-11-25 15:12:56 +01:00
Nick Wellnhofer
9ef80ff1a9 memory: Remove xmlDictInitialized
Call xmlInitParser when creating dicts instead.
2022-11-25 15:02:04 +01:00
Nick Wellnhofer
ed053c50cf dict: Make init/cleanup functions private 2022-11-25 15:02:04 +01:00
Nick Wellnhofer
2e9aeecb4e memory: Remove xmlMemInitialized
Call xmlInitParser instead of xmlInitMemoryInternal.
2022-11-25 15:02:04 +01:00
Nick Wellnhofer
7010d8779b threads: Rework initialization
Make init/cleanup functions private. Merge xmlOnceInit into
xmlInitThreadsInternal.
2022-11-25 15:02:04 +01:00
Nick Wellnhofer
9dbf137455 parser: Make some module init/cleanup functions private 2022-11-25 15:02:04 +01:00
Nick Wellnhofer
cecd364dd2 parser: Don't call *DefaultSAXHandlerInit from xmlInitParser
Change the default handler definitions to match the result after calling
the initialization functions.

This makes sure that no thread-local variables are accessed when calling
xmlInitParser.
2022-11-25 15:02:04 +01:00
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 bfc55d688427972d093be010a8c2ef265375fcb2.

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