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

6953 Commits

Author SHA1 Message Date
makise-homura
f59da1a364 hash: Suppress GCC 7.3 and MINGW maybe-uninitialized warning 2024-08-16 22:26:07 +03:00
makise-homura
103aadbc66 parser: Suppress EDG maybe-uninitialized warning 2024-08-16 22:26:07 +03:00
Nick Wellnhofer
f2c48847fa io: Add missing calls to xmlInitParser
This is required after c9a46a91.

Should fix #782.
2024-08-13 14:38:59 +02:00
Nick Wellnhofer
0c56eb8215 tree: Restore return value of xmlNodeListGetString with NULL list
When passing a NULL list to xmlNodeListGetString or
xmlNodeListGetRawString, return NULL instead of "" to match the old
behavior.

Fixes #783.
2024-08-12 21:38:50 +02:00
Taylor R Campbell
b45a0f0eca nanohttp: Avoid ctype(3) misuse.
fix https://gitlab.gnome.org/GNOME/libxml2/-/issues/780
2024-08-07 11:12:33 +02:00
Nick Wellnhofer
1d009fe35d parser: Report at least one fatal error 2024-08-05 15:14:21 +02:00
Nick Wellnhofer
bfed6e6ae8 parser: Fix error handling after reaching limit
Mark document as non-wellformed and stop parser even if error limit was
reached.

Regressed in abd74186.
2024-08-05 14:58:37 +02:00
Nick Wellnhofer
6e1e22dc5f malloc-fail: Fix null-deref in xmlPatPushState 2024-08-04 11:47:26 +02:00
Nick Wellnhofer
a530ff125d io: Always consume encoding handler when creating output buffers
Also free encoding handler in error case.

Remove xmlAllocOutputBufferInternal which was identical to
xmlAllocOutputBuffer.
2024-07-29 14:25:39 +02:00
Nick Wellnhofer
36ea881b9d malloc-fail: Fix memory leak in xmlOutputBufferCreateFilename
Close encoding handler on error.
2024-07-26 18:07:27 +02:00
Nick Wellnhofer
02fcb1effb parser: Make xmlParseChunk return an error if parser was stopped
This regressed after enhancing the disableSAX member in 2.13.

Should fix #777.
2024-07-25 17:07:18 +02:00
Nick Wellnhofer
bc14d70f49 xmlsave: Improve "unsupported encoding" error message
Incomplete support of XML_SAVE_* error codes was removed. Error handling
still needs work. xmlOutputBufferCreateFilename should return an error
code.
2024-07-25 00:26:48 +02:00
Nick Wellnhofer
1a89323039 [CVE-2024-40896] Fix XXE protection in downstream code
Some users set an entity's children manually in the getEntity SAX
callback to restrict entity expansion. This stopped working after
renaming the "checked" member of xmlEntity, making at least one
downstream project and its dependants susceptible to XXE attacks.

See #761.
2024-07-24 17:19:32 +02:00
Nick Wellnhofer
6cc2387e1a shell: Only use readline on terminals
Should fix xmllint shell tests.
2024-07-24 12:26:39 +02:00
Nick Wellnhofer
d04e152d9c shell: Remove access(2) checks
The checks didn't handle stdout.

Since unistd.h wasn't included, W_OK wasn't defined and the checks
wouldn't run anyway.
2024-07-24 11:42:32 +02:00
Nick Wellnhofer
aa6ca0b1d3 module: Deprecate module API
This was only used by libxslt which switched to a private
implementation.
2024-07-23 19:57:32 +02:00
Nick Wellnhofer
ec4340b828 Update NEWS 2024-07-23 01:32:43 +02:00
Nick Wellnhofer
e1291059af build: Don't check for pthread.h
The Autotools build still checks for pthread.h (and zlib.h and lzma.h)
but the result isn't needed in config.h.
2024-07-22 23:03:55 +02:00
Nick Wellnhofer
cc03c069f5 build: Don't check for standard POSIX headers
These headers should be available since early POSIX days and are
required no matter what.
2024-07-22 23:02:59 +02:00
Nick Wellnhofer
d7dc2eaf06 build: Don't check for dlfcn.h and dl.h
It's enough to check for symbols.
2024-07-22 21:39:54 +02:00
Nick Wellnhofer
7c10393fc0 build: Fix config.h macros
We have to emulate AC_CHECK_DECLS. Instead of leaving the macro
undefined if a symbol wasn't found, it has to be set to 0.
2024-07-22 17:41:41 +02:00
Nick Wellnhofer
095b3c7faf cmake: Implement READLINE and HISTORY options 2024-07-22 17:03:27 +02:00
Nick Wellnhofer
0172ffa99b build: Only check for required headers 2024-07-22 17:03:27 +02:00
Nick Wellnhofer
3ef6661175 build: Rework mmap checks
Switch to AC_CHECK_DECLS/check_symbol_exists. Don't check for
sys/mman.h separately. Don't check for munmap.
2024-07-22 17:03:27 +02:00
Nick Wellnhofer
e1657f3f27 build: Use AC_CHECK_DECLS/check_symbol_exists for getentropy
This assumes that getentropy is declared in sys/random.h.

Should fix issues on iOS. See #774.
2024-07-22 17:03:27 +02:00
Nick Wellnhofer
278fcf13b9 buf: Limit xmlBuffer size to INT_MAX
Some API functions like xmlBufUse only support ints.
2024-07-22 13:02:07 +02:00
Nick Wellnhofer
6a3c0b0d93 parser: Increase XML_MAX_DICTIONARY_LIMIT
This limit is somewhat arbitrary and can be reached when fuzzing
documents up to 1 MB.

Increase limit to 100 MB and disable limit if XML_PARSE_HUGE is set.
2024-07-22 12:53:00 +02:00
Nick Wellnhofer
d2755cdb6f buf: Fix memory leak if malloc fails before xmlBufBackToBuffer
Short-lived regression.
2024-07-22 12:35:29 +02:00
Nick Wellnhofer
322e733b84 xinclude: Fix fallback for text includes
Fixes #772.
2024-07-18 19:32:23 +02:00
Nick Wellnhofer
0dada8041a threads: Fix 32-bit Windows build
Should fix #771.
2024-07-18 03:48:11 +02:00
Nick Wellnhofer
7b98e8d695 io: Don't call getcwd in xmlParserGetDirectory
The "directory" value isn't used internally. Calling getcwd is
unnecessary and can cause problems in sandboxed environments.

Fixes #770.
2024-07-18 03:22:20 +02:00
Nick Wellnhofer
152021002d buf: Fix maxSize behavior
Short-lived regression.
2024-07-18 03:10:33 +02:00
Nick Wellnhofer
2440cb5dd5 buf: Fix xmlBufBackToBuffer
Short-lived regression.
2024-07-18 03:10:33 +02:00
Nick Wellnhofer
5862e9dd37 Add NULL checks
Short-lived regression.
2024-07-18 02:10:16 +02:00
Nick Wellnhofer
4e93425a7f threads: Prefer Win32 over pthreads 2024-07-16 20:03:01 +02:00
Nick Wellnhofer
1f7d4af355 globals: Clean up macros and add comments 2024-07-16 19:58:09 +02:00
Nick Wellnhofer
4f08a1a249 globals: Also use thread-specific storage on "main" thread
Don't treat "main" thread specially. This simplifies access to
thread-specific data.

xmlGetGlobalState can now also fail on the former main thread, leading
to an unrecoverable condition if malloc fails.

The globals were never defined in public header files when compiling
with thread support. Now they're only defined in a legacy build.

Move TlsFree to DllMain to make cleanup more robust on Windows.

Obsoletes #1.
2024-07-16 19:48:40 +02:00
Nick Wellnhofer
769e5a4a42 threads: Allocate global RMutexes statically
Avoid memory allocations during initialization.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
5d36664fc9 memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
ff39f28bd7 schematron: Use xmlMalloc 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
a87944e970 windows: Use DllMain for cleanup 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
5f3f66c683 threads: Use pthread_once and InitOnceExecuteOnce
Static initialization flags aren't thread-safe. Also avoids an
allocation on Windows.

TODO: Breaks xmllint on Windows.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
be250b798f xpath: Remove union swap optimization
This would require locking to make it thread-safe.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
79e119954c error: Make xmlLastError const 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
eb66d03ef7 io: Deprecate a few functions 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
97680d6c08 io: Rework xmlParserInputBufferGrow
Remove dubious (len != 4) check.

Remove compression-related code. This should already be set when
opening the input.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
a6f54f055b io: Fine-tune initial IO buffer size 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
7148b77820 parser: Optimize memory buffer I/O
Reenable zero-copy IO for zero-terminated static memory buffers.

Don't stream zero-terminated dynamic memory buffers on top of creating
a copy.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
34c9108f15 encoding: Add sizeOut argument to xmlCharEncInput
When push parsing, we want to convert as much of the input as possible.
When pull parsing memory buffers, we want to convert data chunk by chunk
to save memory.
2024-07-16 17:42:10 +02:00
Nick Wellnhofer
8e871a31f8 buf: Rework xmlBuffer code
Port most changes made to the xmlBuf code in f3807d76, except that
"size" still includes the terminating NULL byte.

Make xmlSetBufferAllocationScheme, xmlBufferAllocScheme and
xmlDefaultBufferSize no-ops.

Deprecate a few functions.
2024-07-16 17:42:10 +02:00