1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-27 04:55:04 +03:00
Commit Graph

6014 Commits

Author SHA1 Message Date
Christoph Reiter
2473b4855e autotools: fix Python module file ext for cygwin/msys2
both use .dll, not .pyd
2023-06-21 14:38:38 +02:00
David Kilzer
5f54bac9eb testapi: test_xmlSAXDefaultVersion() leaves xmlSAX2DefaultVersionValue set to 1 with LIBXML_SAX1_ENABLED
Add code to save and to restore the default value of
xmlSAX2DefaultVersionValue.

Fixes #554.
2023-06-10 10:55:38 -07:00
Nick Wellnhofer
b236b7a588 parser: Halt parser when growing buffer results in OOM
Fix short-lived regression from previous commit.

It might be safer to make xmlBufSetInputBaseCur use the original buffer
even in case of errors.

Found by OSS-Fuzz.
2023-06-08 21:59:20 +02:00
Nick Wellnhofer
20f5c73457 parser: Recover more input from encoding errors
Don't halt the parser in xmlParserGrow to allow more input to be
recovered in case of encoding errors.

Fixes #543.
2023-06-07 14:05:34 +02:00
Nick Wellnhofer
db21cd5db9 malloc-fail: Handle malloc failures in xmlAddEncodingAlias
Avoid memory errors if an allocation fails.

See #344. Fixes #553.
2023-06-06 14:25:30 +02:00
Nick Wellnhofer
305a75ccbe malloc-fail: Fix null-deref with xmllint --copy
See #344. Fixes #552.
2023-06-06 13:15:46 +02:00
Nick Wellnhofer
6273df6c6d xpath: Ignore entity ref nodes when computing node hash
XPath queries only work reliably if entities are substituted.
Nevertheless, it's possible to query a document with entity reference
nodes. xmllint even deletes entities when the `--dropdtd` option is
passed, resulting in dangling pointers, so it's best to skip entity
reference nodes to avoid a use-after-free.

Fixes #550.
2023-05-30 12:30:27 +02:00
Nick Wellnhofer
e2f21c22d3 win32: Deprecate old Windows build system 2023-05-30 12:03:45 +02:00
Nick Wellnhofer
1e8ab6977d gitlab-ci: Lower _XOPEN_SOURCE value 2023-05-25 03:25:48 +02:00
Nick Wellnhofer
cb8ccb1078 testapi: Don't set http_proxy environment variable
We already disable network access, so this has no effect.
2023-05-25 03:17:45 +02:00
Nick Wellnhofer
9fd57df815 autotools: Improve iconv check
Use a custom test program which includes iconv.h, so we can check
whether the possibly redefined symbols in this header file match the
symbols in the iconv library.

Should fix #547.
2023-05-25 02:47:27 +02:00
Nick Wellnhofer
c3c6cc6202 runtest: Fix compilation without LIBXML_HTML_ENABLED
Fixes #545.
2023-05-24 20:08:56 +02:00
Nick Wellnhofer
981093abd1 test: Add push parser tests for split UTF-8 sequences 2023-05-18 19:35:16 +02:00
Nick Wellnhofer
e0f3016f71 parser: Fix regression when push parsing UTF-8 sequences
Partial UTF-8 sequences are allowed when push parsing.

Fixes #542.
2023-05-18 18:21:20 +02:00
Nick Wellnhofer
687a2b719e xinclude: Lower initial table size when fuzzing
We don't have test cases with many documents, so set the initial table
size to 1 when fuzzing, so there is a chance to detect reallocation
issues.
2023-05-11 13:27:52 +02:00
Nick Wellnhofer
c40cbf07a3 malloc-fail: Fix null deref after xmlXIncludeNewRef
See #344.
2023-05-11 13:27:52 +02:00
Nick Wellnhofer
105ce73da0 xinclude: Fix false positives in inclusion loop detection
xmlXIncludeRecurseDoc can realloc the cache.
2023-05-11 13:27:52 +02:00
Nick Wellnhofer
bdb5667a5c autotools: Fix ICU detection
Fixes #540.
2023-05-10 18:13:47 +02:00
Nick Wellnhofer
9dae389cee parser: Fix "huge input lookup" error with push parser
Fix parsing of larger documents without XML_PARSE_HUGE.

Should fix #538.
2023-05-09 13:30:21 +02:00
Nick Wellnhofer
b8961df65d SAX: Always validate xml:ids
The behavior shouldn't depend on mostly random configuration options.
2023-05-09 03:25:24 +02:00
Nick Wellnhofer
f24ffddbb9 Stop using sprintf
Switch remaining users to snprintf.
2023-05-08 23:33:04 +02:00
Nick Wellnhofer
01723fc68f xpath: Fix build without LIBXML_XPATH_ENABLED
Move static function declaration into XPATH block. Also move comparison
functions.

Fixes #537.
2023-05-08 23:15:30 +02:00
Nick Wellnhofer
235b15a590 SAX: Always initialize SAX1 element handlers
Follow-up to commit d0c3f01e. A parser context will be initialized to
SAX version 2, but this can be overridden with XML_PARSE_SAX1 later,
so we must initialize the SAX1 element handlers as well.

Change the check in xmlDetectSAX2 to only look for XML_SAX2_MAGIC, so
we don't switch to SAX1 if the SAX2 element handlers are NULL.
2023-05-08 19:15:44 +02:00
Mike Dalessio
3463063001
autoconf: fix iconv library paths
and pass cflags when building executables

See 0f77167f for prior related work
2023-05-06 12:26:17 -04:00
Nick Wellnhofer
d0c3f01e11 parser: Fix old SAX1 parser with custom callbacks
For some reason, xmlCtxtUseOptionsInternal set the start and end element
SAX handlers to the internal DOM builder functions when XML_PARSE_SAX1
was specified. This means that custom SAX handlers could never work with
that flag because these functions would receive the wrong user data
argument and crash immediately.

Fixes #535.
2023-05-06 17:47:37 +02:00
Nick Wellnhofer
06a2c251a1 hash: Fix possible startup crash with old libxslt versions
Call xmlInitParser in xmlHashCreate to make it work if the library
wasn't initialized yet.

Otherwise, exsltRegisterAll from libxslt 1.1.24 or older might cause
a crash.

See #534.
2023-05-06 15:28:13 +02:00
Nick Wellnhofer
a800b7e058 regexp: Fix null deref in xmlFAFinishReduceEpsilonTransitions
Short-lived regression found by OSS-Fuzz.
2023-05-04 12:47:00 +02:00
Nick Wellnhofer
8d5e33ef3e Fix compiler warning on GCC < 8
-Wcast-function-type is only available since GCC 8.
2023-05-03 20:42:10 +02:00
Nick Wellnhofer
d6882f6454 threads: Fix startup crash with weak symbol hack
Fix another issue when running with older libc, threads and libpthread
not linked in.
2023-05-03 19:40:57 +02:00
Nick Wellnhofer
7f3f3f115f dict: Raise MAX_DICT_HASH limit
This fixes quadratic behavior with large dictionaries.

Also rework testdict.c to support tests with larger dictionaries.
2023-05-03 19:40:57 +02:00
Nick Wellnhofer
11a95279a9 win32: Don't depend on removed .def file
Fixes broken build after 21cec82b.

Fixes #532.
2023-05-02 13:36:04 +02:00
Nick Wellnhofer
c613ab14b8 regexp: Fix mistake in previous commit
The `ret = 0` line should have been deleted.

Fixes #531.
2023-05-02 00:32:50 +02:00
Nick Wellnhofer
a06eaa6119 regexp: Fix determinism checks
Swap arguments in initial call to xmlFARecurseDeterminism.

Fix the check whether we revisit the initial state in
xmlFARecurseDeterminism.

If there are transitions with equal atoms and targets but different
counters, treat the regex as deterministic but mark the transitions as
non-deterministic internally.

Don't overwrite zero return value of xmlFAComputesDeterminism
with non-zero value from xmlFARecurseDeterminism.

Most of these errors lead to non-deterministic regexes not being
detected which typically isn't an issue. The improved code may break
users who relied on buggy behavior or cause other bugs to become
visible.

Fixes #469.
2023-04-30 22:37:11 +02:00
Nick Wellnhofer
e301865e69 regexp: Fix checks for eliminated transitions
'to' can be set to -1 or -2 when eliminating transitions, so check for
all negative values.
2023-04-30 22:36:51 +02:00
Nick Wellnhofer
90759c598d regexp: Simplify xmlFAReduceEpsilonTransitions 2023-04-30 22:36:41 +02:00
Nick Wellnhofer
9f7b114232 regexp: Fix cycle check in xmlFAReduceEpsilonTransitions
The visited flag must only be reset after the first call to
xmlFAReduceEpsilonTransitions has finished. Visiting states multiple
times could lead to unnecessary processing of duplicate transitions.

Similar to 68eadabd.
2023-04-30 22:36:33 +02:00
Nick Wellnhofer
4f49017e37 tests: Test streaming schema validation 2023-04-30 21:45:39 +02:00
Nick Wellnhofer
d88763ccad schemas: Fix filename in xmlSchemaValidateFile
Make sure that filename appears in error messages.
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
165f3436fc schemas: Fix line numbers in streaming validation 2023-04-30 21:45:39 +02:00
Nick Wellnhofer
57d88da675 schemas: Fix memory leak in xmlSchemaValidateStream
Regressed in 9a82b94a.

Fixes #530.
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
0ffc2d82b5 runtest: Skip element name in schema error messages
This makes sure that memory and streaming tests will report the same
messages.
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
550eaac605 writer: Add error check in xmlTextWriterEndDocument 2023-04-30 21:45:39 +02:00
Nick Wellnhofer
2f12e3a938 encoding: Stop calling xmlEncodingErr
This invokes the global error handler which should be avoided.
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
b230861dbd xmlIO: Remove some calls to xmlIOErr
The xmlIOErr functions use the global error handler and should be
avoided if possible.
2023-04-30 21:45:39 +02:00
Nick Wellnhofer
320f5084cd parser: Improve handling of encoding and IO errors
Make sure that xmlCharEncInput, xmlParserInputBufferPush and
xmlParserInputBufferGrow set the correct error code in the
xmlParserInputBuffer. Handle errors when calling these functions.
2023-04-30 21:31:54 +02:00
Nick Wellnhofer
fc69cf568b parser: Move xmlFatalErr to parserInternals.c 2023-04-30 17:51:29 +02:00
Nick Wellnhofer
3ff6abbf58 encoding: Rework error codes
Use an enum instead of magic numbers. Fix a few error codes. Simplify
handling of "space" and "partial" errors.

See #506.
2023-04-30 16:43:29 +02:00
Nick Wellnhofer
b463b38bcd .gitignore: Split up and rearrange .gitignore files 2023-04-30 16:22:27 +02:00
Nick Wellnhofer
0260de5568 .gitignore: Add runsuite.log 2023-04-30 16:00:44 +02:00
Nick Wellnhofer
886bf4e63b Stop calling xmlMemoryDump
This was used to check for memory leaks but could potentially create a
.memdump file. These days, there are better ways to check for memory
leaks.
2023-04-30 15:48:41 +02:00