|
From: <fli...@li...> - 2026-08-02 12:12:07
|
unknown user pushed a commit to branch release/2024.1
in repository simgear.
The following commit(s) were added to refs/heads/release/2024.1 by this push:
new 4e1687e3 Upgrade to Expat 2.8.2
4e1687e3 is described below
SF URL: http://sourceforge.net/p/flightgear/simgear/ci/4e1687e3da03200a94a1ecc941336023788d4902/
Commit: 4e1687e3da03200a94a1ecc941336023788d4902
Author: James Turner
Committer: James Turner
AuthorDate: Sun Aug 2 09:38:34 2026 +0100
Upgrade to Expat 2.8.2
---
.clang-format-ignore | 4 +
3rdparty/.clang-format | 3 +
3rdparty/expat/CMakeLists.txt | 22 +-
3rdparty/expat/expat_config_cmake.in | 85 +-
3rdparty/expat/{winconfig.h => fallthrough.h} | 28 +-
3rdparty/expat/{winconfig.h => memory_sanitizer.h} | 30 +-
.../expat/{winconfig.h => random_arc4random.c} | 35 +-
.../expat/{winconfig.h => random_arc4random.h} | 18 +-
.../expat/{winconfig.h => random_arc4random_buf.c} | 26 +-
.../expat/{winconfig.h => random_arc4random_buf.h} | 18 +-
.../expat/{winconfig.h => random_dev_urandom.c} | 51 +-
.../expat/{winconfig.h => random_dev_urandom.h} | 19 +-
.../expat/{winconfig.h => random_getentropy.c} | 45 +-
.../expat/{winconfig.h => random_getentropy.h} | 19 +-
3rdparty/expat/random_getrandom.c | 95 +
3rdparty/expat/{winconfig.h => random_getrandom.h} | 19 +-
3rdparty/expat/random_rand_s.c | 88 +
3rdparty/expat/{winconfig.h => random_rand_s.h} | 20 +-
3rdparty/expat/sg_expat.h | 126 +-
3rdparty/expat/sg_expat_external.h | 127 +-
3rdparty/expat/{internal.h => sg_expat_internal.h} | 38 +-
3rdparty/expat/siphash.h | 28 +-
3rdparty/expat/winconfig.h | 7 +-
3rdparty/expat/{winconfig.h => xcsinc.c} | 35 +-
3rdparty/expat/xmlparse.c | 3521 +++++++++++++-------
3rdparty/expat/xmlrole.c | 12 +-
3rdparty/expat/xmlrole.h | 40 +-
3rdparty/expat/xmltok.c | 57 +-
3rdparty/expat/xmltok.h | 234 +-
3rdparty/expat/xmltok_impl.c | 47 +-
3rdparty/expat/xmltok_impl.h | 2 +-
3rdparty/expat/xmltok_ns.c | 5 +-
32 files changed, 3207 insertions(+), 1697 deletions(-)
diff --git a/.clang-format-ignore b/.clang-format-ignore
new file mode 100644
index 00000000..61820484
--- /dev/null
+++ b/.clang-format-ignore
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# SPDX-FileCopyrightText: 2026 James Turner
+
+/3rdparty/**
diff --git a/3rdparty/.clang-format b/3rdparty/.clang-format
new file mode 100644
index 00000000..36f022e4
--- /dev/null
+++ b/3rdparty/.clang-format
@@ -0,0 +1,3 @@
+{
+ "DisableFormat": true
+}
diff --git a/3rdparty/expat/CMakeLists.txt b/3rdparty/expat/CMakeLists.txt
index 4b232414..024dd0cc 100644
--- a/3rdparty/expat/CMakeLists.txt
+++ b/3rdparty/expat/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_library(FGExpat STATIC)
+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
check_cxx_source_compiles(
"#include <sys/random.h>
@@ -21,11 +23,13 @@ configure_file (
"${PROJECT_BINARY_DIR}/3rdparty/expat/simgear_expat_config.h"
)
-set(expat_sources
+target_sources(FGExpat PRIVATE
asciitab.h
+ fallthrough.h
hashtable.h
iasciitab.h
latin1tab.h
+ memory_sanitizer.h
nametab.h
utf8tab.h
xmldef.h
@@ -37,13 +41,22 @@ set(expat_sources
xmlparse.c
xmlrole.c
xmltok.c
- internal.h
+ sg_expat_internal.h
ascii.h
sg_expat.h
- sg_expat_external.h
+ sg_expat_external.h
)
-add_library(FGExpat STATIC ${expat_sources})
+if (WIN32)
+ target_sources(FGExpat PRIVATE random_rand_s.c random_rand_s.h)
+elseif(APPLE)
+ target_sources(FGExpat PRIVATE random_arc4random_buf.c random_arc4random_buf.h)
+elseif(HAVE_GETRANDOM)
+ target_sources(FGExpat PRIVATE random_getrandom.c random_getrandom.h)
+else()
+ # old Linux, BSD
+ target_sources(FGExpat PRIVATE random_dev_urandom.c random_dev_urandom.h)
+endif()
target_include_directories(FGExpat BEFORE PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@@ -54,6 +67,7 @@ target_include_directories(FGExpat PRIVATE ${PROJECT_BINARY_DIR}/3rdparty/expat)
target_compile_definitions(FGExpat PUBLIC HAVE_SIMGEAR_EXPAT_CONFIG_H XML_STATIC)
+
# look like Expat found by find()
add_library(EXPAT::EXPAT ALIAS FGExpat)
diff --git a/3rdparty/expat/expat_config_cmake.in b/3rdparty/expat/expat_config_cmake.in
index b17e2e24..035edc96 100644
--- a/3rdparty/expat/expat_config_cmake.in
+++ b/3rdparty/expat/expat_config_cmake.in
@@ -1,16 +1,12 @@
+/* expat_config.h.cmake. Based upon generated expat_config.h.in. */
#ifndef EXPAT_CONFIG_H
-#define EXPAT_CONFIG_H
+# define EXPAT_CONFIG_H 1
#cmakedefine HAVE_WINDOWS_H
+/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+#cmakedefine BYTEORDER @BYTEORDER@
-#ifdef HAVE_WINDOWS_H
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #undef WIN32_LEAN_AND_MEAN
-#endif
-
-#cmakedefine HAVE_GETRANDOM
#cmakedefine XML_DEV_URANDOM
// we can assume > 10.7 macOS so always set this
@@ -18,32 +14,83 @@
#define HAVE_ARC4RANDOM_BUF
#endif
-/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
-#define BYTEORDER 1234
+#cmakedefine HAVE_GETRANDOM
-/* Define to 1 if you have the `bcopy' function. */
-#cmakedefine HAVE_BCOPY
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
-/* Define to 1 if you have the `memmove' function. */
-#define HAVE_MEMMOVE
+/* Define to 1 if you have the <fcntl.h> header file. */
+#cmakedefine HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getpagesize' function. */
+#cmakedefine HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `getentropy' function. */
+#cmakedefine HAVE_GETENTROPY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
/* Define to 1 if you have a working `mmap' system call. */
#cmakedefine HAVE_MMAP
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H
+/* Define to 1 if you have the ANSI C header files. */
+# ifndef STDC_HEADERS
+#cmakedefine STDC_HEADERS
+# endif
+
/* whether byteorder is bigendian */
-#undef WORDS_BIGENDIAN
+#cmakedefine WORDS_BIGENDIAN
+
+/* Define to allow retrieving the byte offsets for attribute names and values.
+ */
+#cmakedefine XML_ATTR_INFO
/* Define to specify how much context to retain around the current parse
- point. */
+ point, 0 to disable. */
#define XML_CONTEXT_BYTES 1024
/* Define to make parameter entity parsing functionality available. */
-#define XML_DTD
+#define XML_DTD 1
+
+/* Define as 1/0 to enable/disable support for general entities. */
+#define XML_GE 1
/* Define to make XML Namespaces functionality available. */
-#define XML_NS
+#define XML_NS 1
+
+/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
+# ifdef _MSC_VER
+# define __func__ __FUNCTION__
+# endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+#cmakedefine off_t @off_t@
-#endif /* ifndef EXPAT_CONFIG_H */
+#endif // ndef EXPAT_CONFIG_H
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/fallthrough.h
similarity index 71%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/fallthrough.h
index 2ecd61b5..707dbdd4 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/fallthrough.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Nick Begg <ni...@st...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,21 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#ifndef FALLTHROUGH_H
+# define FALLTHROUGH_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+// Explicit fallthrough in switch case to avoid warnings
+// with compiler flag -Wimplicit-fallthrough.
-#include <memory.h>
-#include <string.h>
+# define EXPAT_FALLTHROUGH \
+ do { \
+ } while (0)
-#endif /* ndef WINCONFIG_H */
+# if defined(__has_attribute)
+# if __has_attribute(fallthrough)
+# undef EXPAT_FALLTHROUGH
+# define EXPAT_FALLTHROUGH __attribute__((fallthrough))
+# endif
+# endif
+
+#endif // FALLTHROUGH_H
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/memory_sanitizer.h
similarity index 68%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/memory_sanitizer.h
index 2ecd61b5..a8a8006c 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/memory_sanitizer.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,23 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(MEMORY_SANITIZER_H)
+# define MEMORY_SANITIZER_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# if defined(__has_feature)
+# if __has_feature(memory_sanitizer)
+# include <sanitizer/msan_interface.h>
-#include <memory.h>
-#include <string.h>
+// inform Memory Sanitizer that [base, base + extent) is now initialized
+# define MSAN_UNPOISON(base, extent) __msan_unpoison((base), (extent))
-#endif /* ndef WINCONFIG_H */
+# endif
+# endif
+
+# if ! defined(MSAN_UNPOISON)
+# define MSAN_UNPOISON(base, extent) \
+ do { \
+ } while (0)
+# endif
+
+#endif // ! defined(MEMORY_SANITIZER_H)
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_arc4random.c
similarity index 66%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_arc4random.c
index 2ecd61b5..243fbbc8 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_arc4random.c
@@ -6,10 +6,8 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2017-2026 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +30,27 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#include "random_arc4random.h"
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+#if ! defined(_DEFAULT_SOURCE)
+# define _DEFAULT_SOURCE 1 /* for glibc */
+#endif
-#include <memory.h>
-#include <string.h>
+#include <stdint.h> // for uint32_t
+#include <stdlib.h> // for arc4random
+#include <string.h> // for memcpy
-#endif /* ndef WINCONFIG_H */
+void
+writeRandomBytes_arc4random(void *target, size_t count) {
+ size_t bytesWrittenTotal = 0;
+
+ while (bytesWrittenTotal < count) {
+ const uint32_t random32 = arc4random();
+
+ size_t toUse = count - bytesWrittenTotal;
+ if (toUse > sizeof(random32))
+ toUse = sizeof(random32);
+ memcpy((char *)target + bytesWrittenTotal, &random32, toUse);
+ bytesWrittenTotal += toUse;
+ }
+}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_arc4random.h
similarity index 76%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_arc4random.h
index 2ecd61b5..54fbd4c4 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_arc4random.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,11 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(RANDOM_ACR4RANDOM_H)
+# define RANDOM_ACR4RANDOM_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# include <stddef.h> // for size_t
-#include <memory.h>
-#include <string.h>
+void writeRandomBytes_arc4random(void *target, size_t count);
-#endif /* ndef WINCONFIG_H */
+#endif // ! defined(RANDOM_ACR4RANDOM_H)
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_arc4random_buf.c
similarity index 73%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_arc4random_buf.c
index 2ecd61b5..5212b9f1 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_arc4random_buf.c
@@ -6,10 +6,8 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +30,18 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#include "random_arc4random_buf.h"
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+#if ! defined(_DEFAULT_SOURCE)
+# define _DEFAULT_SOURCE 1 /* for glibc */
+#endif
-#include <memory.h>
-#include <string.h>
+#include "memory_sanitizer.h"
+#include <stdlib.h> // for arc4random_buf
-#endif /* ndef WINCONFIG_H */
+void
+writeRandomBytes_arc4random_buf(void *target, size_t count) {
+ arc4random_buf(target, count);
+ // MSan does not understand `arc4random_buf`, so explain its effects
+ MSAN_UNPOISON(target, count);
+}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_arc4random_buf.h
similarity index 76%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_arc4random_buf.h
index 2ecd61b5..51f7a31f 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_arc4random_buf.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,11 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(RANDOM_ACR4RANDOM_BUF_H)
+# define RANDOM_ACR4RANDOM_BUF_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# include <stddef.h> // for size_t
-#include <memory.h>
-#include <string.h>
+void writeRandomBytes_arc4random_buf(void *target, size_t count);
-#endif /* ndef WINCONFIG_H */
+#endif // ! defined(RANDOM_ACR4RANDOM_BUF_H)
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_dev_urandom.c
similarity index 55%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_dev_urandom.c
index 2ecd61b5..acae6ba4 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_dev_urandom.c
@@ -6,10 +6,8 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2017-2026 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +30,43 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#include "random_dev_urandom.h"
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+#if ! defined(_POSIX_C_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE < 200809L))
+# define _POSIX_C_SOURCE 200809L // for O_CLOEXEC
+#endif
-#include <memory.h>
-#include <string.h>
+#include <errno.h>
+#include <fcntl.h> // open
+#include <unistd.h> // close
-#endif /* ndef WINCONFIG_H */
+/* Extract entropy from /dev/urandom */
+bool
+writeRandomBytes_dev_urandom(void *target, size_t count) {
+ int success = false; /* full count bytes written? */
+ size_t bytesWrittenTotal = 0;
+
+ const int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
+ if (fd < 0) {
+ return false;
+ }
+
+ do {
+ void *const currentTarget = (char *)target + bytesWrittenTotal;
+ const size_t bytesToWrite = count - bytesWrittenTotal;
+
+ errno = 0;
+
+ const ssize_t bytesWrittenMore = read(fd, currentTarget, bytesToWrite);
+
+ if (bytesWrittenMore > 0) {
+ bytesWrittenTotal += bytesWrittenMore;
+ if (bytesWrittenTotal >= count)
+ success = true;
+ }
+ } while (! success && (errno == EINTR));
+
+ close(fd);
+ return success;
+}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_dev_urandom.h
similarity index 76%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_dev_urandom.h
index 2ecd61b5..d9cf767b 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_dev_urandom.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,12 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(RANDOM_DEV_URANDOM_H)
+# define RANDOM_DEV_URANDOM_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# include <stdbool.h>
+# include <stddef.h> // for size_t
-#include <memory.h>
-#include <string.h>
+bool writeRandomBytes_dev_urandom(void *target, size_t count);
-#endif /* ndef WINCONFIG_H */
+#endif // ! defined(RANDOM_DEV_URANDOM_H)
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_getentropy.c
similarity index 62%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_getentropy.c
index 2ecd61b5..5cea2d88 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_getentropy.c
@@ -6,10 +6,8 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +30,31 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-#include <memory.h>
-#include <string.h>
-
-#endif /* ndef WINCONFIG_H */
+#include "random_getentropy.h"
+
+// NOTE: Please keep this block in sync with its two siblings in files
+// `configure.ac` and `ConfigureChecks.cmake`!
+#if defined(__APPLE__)
+# include <sys/random.h>
+#else
+# if defined(__GLIBC__) && ! defined(_DEFAULT_SOURCE)
+# define _DEFAULT_SOURCE 1
+# endif
+# if ! defined(_GNU_SOURCE)
+# define _GNU_SOURCE 1 /* for musl */
+# endif
+# include <unistd.h>
+#endif // ! defined(__APPLE__)
+
+#include "memory_sanitizer.h"
+#include <errno.h>
+
+bool
+writeRandomBytes_getentropy(void *target, size_t count) {
+ errno = 0;
+ const bool success = getentropy(target, count);
+ // MSan does not understand `getentropy`, so explain its effects
+ if (success)
+ MSAN_UNPOISON(target, count);
+ return success;
+}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_getentropy.h
similarity index 76%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_getentropy.h
index 2ecd61b5..a00b16bf 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_getentropy.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,12 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(RANDOM_GETENTROPY_H)
+# define RANDOM_GETENTROPY_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# include <stdbool.h>
+# include <stddef.h> // for size_t
-#include <memory.h>
-#include <string.h>
+bool writeRandomBytes_getentropy(void *target, size_t count);
-#endif /* ndef WINCONFIG_H */
+#endif // ! defined(RANDOM_GETENTROPY_H)
diff --git a/3rdparty/expat/random_getrandom.c b/3rdparty/expat/random_getrandom.c
new file mode 100644
index 00000000..72e2cc70
--- /dev/null
+++ b/3rdparty/expat/random_getrandom.c
@@ -0,0 +1,95 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 2017-2026 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2017 Chanho Park <cha...@sa...>
+ Copyright (c) 2022 Sean McBride <se...@ro...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
+ Licensed under the MIT license:
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the
+ following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "expat_config.h" // for HAVE_GETRANDOM, HAVE_SYSCALL_GETRANDOM
+
+#include "random_getrandom.h"
+
+#if defined(HAVE_GETRANDOM)
+# include <sys/random.h> /* getrandom */
+#endif
+
+#if defined(HAVE_SYSCALL_GETRANDOM)
+# if ! defined(_GNU_SOURCE)
+# define _GNU_SOURCE 1 /* syscall prototype */
+# endif
+# include <unistd.h> /* syscall */
+# include <sys/syscall.h> /* SYS_getrandom */
+#endif // defined(HAVE_SYSCALL_GETRANDOM)
+
+#if ! defined(GRND_NONBLOCK)
+# define GRND_NONBLOCK 0x0001
+#endif /* defined(GRND_NONBLOCK) */
+
+#include "memory_sanitizer.h"
+#include <assert.h>
+#include <errno.h>
+#include <limits.h> // for INT_MAX
+
+/* Obtain entropy on Linux 3.17+ */
+bool
+writeRandomBytes_getrandom_nonblock(void *target, size_t count) {
+ int success = false; /* full count bytes written? */
+ size_t bytesWrittenTotal = 0;
+ const unsigned int getrandomFlags = GRND_NONBLOCK;
+
+ do {
+ void *const currentTarget = (char *)target + bytesWrittenTotal;
+ const size_t bytesToWrite = count - bytesWrittenTotal;
+
+ assert(bytesToWrite <= INT_MAX);
+
+ errno = 0;
+
+ const int bytesWrittenMore =
+#if defined(HAVE_GETRANDOM)
+ (int)getrandom(currentTarget, bytesToWrite, getrandomFlags);
+ // MSan understands `getrandom`, so does not need extra guidance
+#else
+ (int)syscall(SYS_getrandom, currentTarget, bytesToWrite,
+ getrandomFlags);
+ // MSan does not understand `syscall`, so explain its effects
+ if (bytesWrittenMore > 0)
+ MSAN_UNPOISON(currentTarget, bytesWrittenMore);
+#endif
+
+ if (bytesWrittenMore > 0) {
+ bytesWrittenTotal += bytesWrittenMore;
+ if (bytesWrittenTotal >= count)
+ success = true;
+ }
+ } while (! success && (errno == EINTR));
+
+ return success;
+}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_getrandom.h
similarity index 76%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_getrandom.h
index 2ecd61b5..ed4d829c 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_getrandom.h
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +29,12 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(RANDOM_GETRANDOM_H)
+# define RANDOM_GETRANDOM_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# include <stdbool.h>
+# include <stddef.h> // for size_t
-#include <memory.h>
-#include <string.h>
+bool writeRandomBytes_getrandom_nonblock(void *target, size_t count);
-#endif /* ndef WINCONFIG_H */
+#endif // ! defined(RANDOM_GETRANDOM_H)
diff --git a/3rdparty/expat/random_rand_s.c b/3rdparty/expat/random_rand_s.c
new file mode 100644
index 00000000..46156563
--- /dev/null
+++ b/3rdparty/expat/random_rand_s.c
@@ -0,0 +1,88 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 2019 David Loffredo <lof...@st...>
+ Copyright (c) 2019-2026 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2019 Ben Wagner <bun...@ch...>
+ Copyright (c) 2019 Vadim Zeitlin <va...@ze...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
+ Licensed under the MIT license:
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the
+ following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "random_rand_s.h"
+
+/* force stdlib to define rand_s() */
+#if ! defined(_CRT_RAND_S)
+# define _CRT_RAND_S
+#endif
+
+// Workaround MinGW GCC trouble with recognizing `rand_s`, likely related
+// to return type `error_t`; the symptom was:
+// > error: implicit declaration of function ‘rand_s’
+#if defined(__MINGW32__)
+# include <errno.h>
+#endif
+
+#include <stdlib.h> // for rand_s
+#include <string.h> // for memcpy
+
+// Help clang-tidy out with prototype of function `rand_s`
+#if defined(XML_CLANG_TIDY)
+int rand_s(unsigned int *);
+#endif
+
+/* Provide declaration of rand_s() for MinGW-32 (not 64, which has it),
+ as it didn't declare it in its header prior to version 5.3.0 of its
+ runtime package (mingwrt, containing stdlib.h). The upstream fix
+ was introduced at https://osdn.net/projects/mingw/ticket/39658 . */
+#if defined(__MINGW32__) && defined(__MINGW32_VERSION) \
+ && __MINGW32_VERSION < 5003000L && ! defined(__MINGW64_VERSION_MAJOR)
+__declspec(dllimport) int rand_s(unsigned int *);
+#endif
+
+/* Obtain entropy on Windows using the rand_s() function which
+ * generates cryptographically secure random numbers. Internally it
+ * uses RtlGenRandom API which is present in Windows XP and later.
+ */
+bool
+writeRandomBytes_rand_s(void *target, size_t count) {
+ size_t bytesWrittenTotal = 0;
+
+ while (bytesWrittenTotal < count) {
+ unsigned int random32 = 0;
+
+ if (rand_s(&random32))
+ return false; /* failure */
+
+ size_t toUse = count - bytesWrittenTotal;
+ if (toUse > sizeof(random32))
+ toUse = sizeof(random32);
+ memcpy((char *)target + bytesWrittenTotal, &random32, toUse);
+ bytesWrittenTotal += toUse;
+ }
+ return true; /* success */
+}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/random_rand_s.h
similarity index 76%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/random_rand_s.h
index 2ecd61b5..2b487d62 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/random_rand_s.h
@@ -6,10 +6,8 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2019 David Loffredo <lof...@st...>
+ Copyright (c) 2026 Sebastian Pipping <seb...@pi...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -32,14 +30,12 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
+#if ! defined(RANDOM_RAND_S_H)
+# define RANDOM_RAND_S_H 1
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+# include <stdbool.h>
+# include <stddef.h> // for size_t
-#include <memory.h>
-#include <string.h>
+bool writeRandomBytes_rand_s(void *target, size_t count);
-#endif /* ndef WINCONFIG_H */
+#endif // ! defined(RANDOM_RAND_S_H)
diff --git a/3rdparty/expat/sg_expat.h b/3rdparty/expat/sg_expat.h
index 14c06f7b..0cd019ee 100644
--- a/3rdparty/expat/sg_expat.h
+++ b/3rdparty/expat/sg_expat.h
@@ -11,10 +11,15 @@
Copyright (c) 2000-2005 Fred L. Drake, Jr. <fd...@us...>
Copyright (c) 2001-2002 Greg Stein <gs...@us...>
Copyright (c) 2002-2016 Karl Waclawek <ka...@wa...>
- Copyright (c) 2016-2022 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2016-2026 Sebastian Pipping <seb...@pi...>
Copyright (c) 2016 Cristian Rodríguez <crr...@op...>
Copyright (c) 2016 Thomas Beutlich <tc...@tb...>
Copyright (c) 2017 Rhodri James <rh...@wi...>
+ Copyright (c) 2022 Thijs Schreijer <th...@th...>
+ Copyright (c) 2023 Hanno Böck <ha...@ge...>
+ Copyright (c) 2023 Sony Corporation / Snild Dolkow <sn...@so...>
+ Copyright (c) 2024 Taichi Haradaguchi <200...@ym...>
+ Copyright (c) 2025 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -37,22 +42,24 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef Expat_INCLUDED
-#define Expat_INCLUDED 1
+#ifndef SG_Expat_INCLUDED
+# define SG_Expat_INCLUDED 1
-#include <stdlib.h>
-#include "sg_expat_external.h"
+# include <stdint.h> // for uint8_t
+# include <stdlib.h>
-#ifdef __cplusplus
+# include "sg_expat_external.h"
+
+# ifdef __cplusplus
extern "C" {
-#endif
+# endif
struct XML_ParserStruct;
typedef struct XML_ParserStruct *XML_Parser;
typedef unsigned char XML_Bool;
-#define XML_TRUE ((XML_Bool)1)
-#define XML_FALSE ((XML_Bool)0)
+# define XML_TRUE ((XML_Bool)1)
+# define XML_FALSE ((XML_Bool)0)
/* The XML_Status enum gives the possible return values for several
API functions. The preprocessor #defines are included so this
@@ -69,11 +76,11 @@ typedef unsigned char XML_Bool;
*/
enum XML_Status {
XML_STATUS_ERROR = 0,
-#define XML_STATUS_ERROR XML_STATUS_ERROR
+# define XML_STATUS_ERROR XML_STATUS_ERROR
XML_STATUS_OK = 1,
-#define XML_STATUS_OK XML_STATUS_OK
+# define XML_STATUS_OK XML_STATUS_OK
XML_STATUS_SUSPENDED = 2
-#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
+# define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
};
enum XML_Error {
@@ -126,7 +133,9 @@ enum XML_Error {
/* Added in 2.3.0. */
XML_ERROR_NO_BUFFER,
/* Added in 2.4.0. */
- XML_ERROR_AMPLIFICATION_LIMIT_BREACH
+ XML_ERROR_AMPLIFICATION_LIMIT_BREACH,
+ /* Added in 2.6.4. */
+ XML_ERROR_NOT_STARTED,
};
enum XML_Content_Type {
@@ -174,8 +183,10 @@ struct XML_cp {
};
/* This is called for an element declaration. See above for
- description of the model argument. It's the caller's responsibility
- to free model when finished with it.
+ description of the model argument. It's the user code's responsibility
+ to free model when finished with it. See XML_FreeContentModel.
+ There is no need to free the model from the handler, it can be kept
+ around and freed at a later stage.
*/
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
const XML_Char *name,
@@ -237,6 +248,17 @@ XML_ParserCreate(const XML_Char *encoding);
and the local part will be concatenated without any separator.
It is a programming error to use the separator '\0' with namespace
triplets (see XML_SetReturnNSTriplet).
+ If a namespace separator is chosen that can be part of a URI or
+ part of an XML name, splitting an expanded name back into its
+ 1, 2 or 3 original parts on application level in the element handler
+ may end up vulnerable, so these are advised against; sane choices for
+ a namespace separator are e.g. '\n' (line feed) and '|' (pipe).
+
+ Note that Expat does not validate namespace URIs (beyond encoding)
+ against RFC 3986 today (and is not required to do so with regard to
+ the XML 1.0 namespaces specification) but it may start doing that
+ in future releases. Before that, an application using Expat must
+ be ready to receive namespace URIs containing non-URI characters.
*/
XMLPARSEAPI(XML_Parser)
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
@@ -255,9 +277,9 @@ XML_ParserCreate_MM(const XML_Char *encoding,
const XML_Memory_Handling_Suite *memsuite,
const XML_Char *namespaceSeparator);
-/* Prepare a parser object to be re-used. This is particularly
+/* Prepare a parser object to be reused. This is particularly
valuable when memory allocation overhead is disproportionately high,
- such as when a large number of small documnents need to be parsed.
+ such as when a large number of small documents need to be parsed.
All handlers are cleared from the parser, except for the
unknownEncodingHandler. The parser's external state is re-initialized
except for the values of ns and ns_triplets.
@@ -317,7 +339,7 @@ typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,
const XML_Char *pubid,
int has_internal_subset);
-/* This is called for the start of the DOCTYPE declaration when the
+/* This is called for the end of the DOCTYPE declaration when the
closing > is encountered, but after processing any external
subset.
*/
@@ -661,7 +683,7 @@ XMLPARSEAPI(void)
XML_SetUserData(XML_Parser parser, void *userData);
/* Returns the last value set by XML_SetUserData or NULL. */
-#define XML_GetUserData(parser) (*(void **)(parser))
+# define XML_GetUserData(parser) (*(void **)(parser))
/* This is equivalent to supplying an encoding argument to
XML_ParserCreate. On success XML_SetEncoding returns non-zero,
@@ -733,7 +755,7 @@ XML_GetSpecifiedAttributeCount(XML_Parser parser);
XMLPARSEAPI(int)
XML_GetIdAttributeIndex(XML_Parser parser);
-#ifdef XML_ATTR_INFO
+# ifdef XML_ATTR_INFO
/* Source file byte offsets for the start and end of attribute names and values.
The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
file an attribute value of "blah" will yield:
@@ -754,7 +776,7 @@ typedef struct {
*/
XMLPARSEAPI(const XML_AttrInfo *)
XML_GetAttributeInfo(XML_Parser parser);
-#endif
+# endif
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
detected. The last call to XML_Parse must have isFinal true; len
@@ -897,10 +919,21 @@ XML_SetParamEntityParsing(XML_Parser parser,
function behavior. This must be called before parsing is started.
Returns 1 if successful, 0 when called after parsing has started.
Note: If parser == NULL, the function will do nothing and return 0.
+ DEPRECATED since Expat 2.8.0.
*/
XMLPARSEAPI(int)
XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
+/* Sets the hash salt to use for internal hash calculations.
+ Helps in preventing DoS attacks based on predicting hash function behavior.
+ This must be called before parsing is started.
+ Returns XML_TRUE if successful, XML_FALSE when called after parsing has
+ started or when parser is NULL.
+ Added in Expat 2.8.0.
+*/
+XMLPARSEAPI(XML_Bool)
+XML_SetHashSalt16Bytes(XML_Parser parser, const uint8_t entropy[16]);
+
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
XML_GetErrorCode returns information about the error.
*/
@@ -937,7 +970,7 @@ XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
XMLPARSEAPI(int)
XML_GetCurrentByteCount(XML_Parser parser);
-/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
+/* If XML_CONTEXT_BYTES is >=1, returns the input buffer, sets
the integer pointed to by offset to the offset within this buffer
of the current parse position, and sets the integer pointed to by size
to the size of this buffer (the number of input bytes). Otherwise
@@ -951,9 +984,9 @@ XMLPARSEAPI(const char *)
XML_GetInputContext(XML_Parser parser, int *offset, int *size);
/* For backwards compatibility with previous versions. */
-#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
-#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
-#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
+# define XML_GetErrorLineNumber XML_GetCurrentLineNumber
+# define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
+# define XML_GetErrorByteIndex XML_GetCurrentByteIndex
/* Frees the content model passed to the element declaration handler */
XMLPARSEAPI(void)
@@ -1011,7 +1044,12 @@ enum XML_FeatureEnum {
XML_FEATURE_ATTR_INFO,
/* Added in Expat 2.4.0. */
XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
- XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT
+ XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT,
+ /* Added in Expat 2.6.0. */
+ XML_FEATURE_GE,
+ /* Added in Expat 2.7.2. */
+ XML_FEATURE_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT,
+ XML_FEATURE_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT,
/* Additional features must be added to the end of this enum. */
};
@@ -1024,27 +1062,43 @@ typedef struct {
XMLPARSEAPI(const XML_Feature *)
XML_GetFeatureList(void);
-#ifdef XML_DTD
-/* Added in Expat 2.4.0. */
+# if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
+/* Added in Expat 2.4.0 for XML_DTD defined and
+ * added in Expat 2.6.0 for XML_GE == 1. */
XMLPARSEAPI(XML_Bool)
XML_SetBillionLaughsAttackProtectionMaximumAmplification(
XML_Parser parser, float maximumAmplificationFactor);
-/* Added in Expat 2.4.0. */
+/* Added in Expat 2.4.0 for XML_DTD defined and
+ * added in Expat 2.6.0 for XML_GE == 1. */
XMLPARSEAPI(XML_Bool)
XML_SetBillionLaughsAttackProtectionActivationThreshold(
XML_Parser parser, unsigned long long activationThresholdBytes);
-#endif
+
+/* Added in Expat 2.7.2. */
+XMLPARSEAPI(XML_Bool)
+XML_SetAllocTrackerMaximumAmplification(XML_Parser parser,
+ float maximumAmplificationFactor);
+
+/* Added in Expat 2.7.2. */
+XMLPARSEAPI(XML_Bool)
+XML_SetAllocTrackerActivationThreshold(
+ XML_Parser parser, unsigned long long activationThresholdBytes);
+# endif
+
+/* Added in Expat 2.6.0. */
+XMLPARSEAPI(XML_Bool)
+XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
/* Expat follows the semantic versioning convention.
- See http://semver.org.
+ See https://semver.org
*/
-#define XML_MAJOR_VERSION 2
-#define XML_MINOR_VERSION 4
-#define XML_MICRO_VERSION 4
+# define XML_MAJOR_VERSION 2
+# define XML_MINOR_VERSION 8
+# define XML_MICRO_VERSION 2
-#ifdef __cplusplus
+# ifdef __cplusplus
}
-#endif
+# endif
#endif /* not Expat_INCLUDED */
diff --git a/3rdparty/expat/sg_expat_external.h b/3rdparty/expat/sg_expat_external.h
index 8829f770..7f5c4c3a 100644
--- a/3rdparty/expat/sg_expat_external.h
+++ b/3rdparty/expat/sg_expat_external.h
@@ -12,9 +12,10 @@
Copyright (c) 2001-2002 Greg Stein <gs...@us...>
Copyright (c) 2002-2006 Karl Waclawek <ka...@wa...>
Copyright (c) 2016 Cristian Rodríguez <crr...@op...>
- Copyright (c) 2016-2019 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2016-2025 Sebastian Pipping <seb...@pi...>
Copyright (c) 2017 Rhodri James <rh...@wi...>
Copyright (c) 2018 Yury Gribov <tet...@gm...>
+ Copyright (c) 2026 Matthew Fernandez <mat...@gm...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -38,14 +39,14 @@
*/
#ifndef Expat_External_INCLUDED
-#define Expat_External_INCLUDED 1
+# define Expat_External_INCLUDED 1
/* External API definitions */
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
- achieve some different behavior, but doing so it not recommended or
+ achieve some different behavior, but doing so is not recommended or
tested frequently.
XMLCALL - The calling convention to use for all calls across the
@@ -64,12 +65,12 @@
compiled with the cdecl calling convention as the default since
system headers may assume the cdecl convention.
*/
-#ifndef XMLCALL
-# if defined(_MSC_VER)
-# define XMLCALL __cdecl
-# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
-# define XMLCALL __attribute__((cdecl))
-# else
+# ifndef XMLCALL
+# if defined(_MSC_VER)
+# define XMLCALL __cdecl
+# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
+# define XMLCALL __attribute__((cdecl))
+# else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
@@ -80,86 +81,86 @@
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
-# define XMLCALL
-# endif
-#endif /* not defined XMLCALL */
+# define XMLCALL
+# endif
+# endif /* not defined XMLCALL */
-#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
-# ifndef XML_BUILDING_EXPAT
+# if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
+# ifndef XML_BUILDING_EXPAT
/* using Expat from an application */
-# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
-# define XMLIMPORT __declspec(dllimport)
+# if defined(_MSC_VER) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
+# define XMLIMPORT __declspec(dllimport)
+# endif
+
# endif
+# endif /* not defined XML_STATIC */
+# ifndef XML_ENABLE_VISIBILITY
+# define XML_ENABLE_VISIBILITY 0
# endif
-#endif /* not defined XML_STATIC */
-
-#ifndef XML_ENABLE_VISIBILITY
-# define XML_ENABLE_VISIBILITY 0
-#endif
-#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
-# define XMLIMPORT __attribute__((visibility("default")))
-#endif
+# if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
+# define XMLIMPORT __attribute__((visibility("default")))
+# endif
/* If we didn't define it above, define it away: */
-#ifndef XMLIMPORT
-# define XMLIMPORT
-#endif
-
-#if defined(__GNUC__) \
- && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
-# define XML_ATTR_MALLOC __attribute__((__malloc__))
-#else
-# define XML_ATTR_MALLOC
-#endif
-
-#if defined(__GNUC__) \
- && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
-#else
-# define XML_ATTR_ALLOC_SIZE(x)
-#endif
-
-#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+# ifndef XMLIMPORT
+# define XMLIMPORT
+# endif
+
+# if defined(__GNUC__) \
+ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
+# define XML_ATTR_MALLOC __attribute__((__malloc__))
+# else
+# define XML_ATTR_MALLOC
+# endif
-#ifdef XML_UNICODE_WCHAR_T
-# ifndef XML_UNICODE
-# define XML_UNICODE
+# if defined(__GNUC__) \
+ && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+# else
+# define XML_ATTR_ALLOC_SIZE(x)
# endif
-# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
-# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
+
+# define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
+
+# ifdef __cplusplus
+extern "C" {
# endif
-#endif
-#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
# ifdef XML_UNICODE_WCHAR_T
+# ifndef XML_UNICODE
+# define XML_UNICODE
+# endif
+# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
+# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
+# endif
+# endif
+
+# ifdef XML_UNICODE /* Information is UTF-16 encoded. */
+# ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
-# else
+# else
typedef unsigned short XML_Char;
typedef char XML_LChar;
-# endif /* XML_UNICODE_WCHAR_T */
-#else /* Information is UTF-8 encoded. */
+# endif /* XML_UNICODE_WCHAR_T */
+# else /* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
-#endif /* XML_UNICODE */
+# endif /* XML_UNICODE */
-#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
+# ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
typedef long long XML_Index;
typedef unsigned long long XML_Size;
-#else
+# else
typedef long XML_Index;
typedef unsigned long XML_Size;
-#endif /* XML_LARGE_SIZE */
+# endif /* XML_LARGE_SIZE */
-#ifdef __cplusplus
+# ifdef __cplusplus
}
-#endif
+# endif
#endif /* not Expat_External_INCLUDED */
diff --git a/3rdparty/expat/internal.h b/3rdparty/expat/sg_expat_internal.h
similarity index 77%
rename from 3rdparty/expat/internal.h
rename to 3rdparty/expat/sg_expat_internal.h
index 28324db9..48866c3a 100644
--- a/3rdparty/expat/internal.h
+++ b/3rdparty/expat/sg_expat_internal.h
@@ -28,9 +28,11 @@
Copyright (c) 2002-2003 Fred L. Drake, Jr. <fd...@us...>
Copyright (c) 2002-2006 Karl Waclawek <ka...@wa...>
Copyright (c) 2003 Greg Stein <gs...@us...>
- Copyright (c) 2016-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2016-2026 Sebastian Pipping <seb...@pi...>
Copyright (c) 2018 Yury Gribov <tet...@gm...>
Copyright (c) 2019 David Loffredo <lof...@st...>
+ Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <sn...@so...>
+ Copyright (c) 2024 Taichi Haradaguchi <200...@ym...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -106,8 +108,12 @@
#endif
#include <limits.h> // ULONG_MAX
+#include <stddef.h> // size_t
-#if defined(_WIN32) && ! defined(__USE_MINGW_ANSI_STDIO)
+#if defined(_WIN32) \
+ && (! defined(__USE_MINGW_ANSI_STDIO) \
+ || (1 - __USE_MINGW_ANSI_STDIO - 1 == 0))
+# define EXPAT_FMT_LLX(midpart) "%" midpart "I64x"
# define EXPAT_FMT_ULL(midpart) "%" midpart "I64u"
# if defined(_WIN64) // Note: modifiers "td" and "zu" do not work for MinGW
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "I64d"
@@ -117,12 +123,16 @@
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
# endif
#else
+# define EXPAT_FMT_LLX(midpart) "%" midpart "llx"
# define EXPAT_FMT_ULL(midpart) "%" midpart "llu"
# if ! defined(ULONG_MAX)
# error Compiler did not define ULONG_MAX for us
# elif ULONG_MAX == 18446744073709551615u // 2^64-1
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "ld"
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "lu"
+# elif defined(__wasm32__) // 32bit mode Emscripten or WASI SDK
+# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "ld"
+# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "zu"
# else
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
@@ -141,6 +151,16 @@
100.0f
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT \
8388608 // 8 MiB, 2^23
+
+#define EXPAT_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT 100.0f
+#define EXPAT_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT \
+ 67108864 // 64 MiB, 2^26
+
+// NOTE: If function expat_alloc was user facing, EXPAT_MALLOC_ALIGNMENT would
+// have to take sizeof(long double) into account
+#define EXPAT_MALLOC_ALIGNMENT sizeof(long long) // largest parser (sub)member
+#define EXPAT_MALLOC_PADDING ((EXPAT_MALLOC_ALIGNMENT) - sizeof(size_t))
+
/* NOTE END */
#include "sg_expat.h" // so we can use type XML_Parser below
@@ -152,12 +172,24 @@ extern "C" {
void _INTERNAL_trim_to_complete_utf8_characters(const char *from,
const char **fromLimRef);
-#if defined(XML_DTD)
+#if defined(XML_GE) && XML_GE == 1
unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser);
unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser);
const char *unsignedCharToPrintable(unsigned char c);
#endif
+extern
+#if ! defined(XML_TESTING)
+ const
+#endif
+ XML_Bool g_reparseDeferralEnabledDefault; // written ONLY in runtests.c
+#if defined(XML_TESTING)
+void *expat_malloc(XML_Parser parser, size_t size, int sourceLine);
+void expat_free(XML_Parser parser, void *ptr, int sourceLine);
+void *expat_realloc(XML_Parser parser, void *ptr, size_t size, int sourceLine);
+extern unsigned int g_bytesScanned; // used for testing only
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/3rdparty/expat/siphash.h b/3rdparty/expat/siphash.h
index e5406d7e..be216b40 100644
--- a/3rdparty/expat/siphash.h
+++ b/3rdparty/expat/siphash.h
@@ -100,13 +100,14 @@
#include <stddef.h> /* size_t */
#include <stdint.h> /* uint64_t uint32_t uint8_t */
+#include "fallthrough.h"
/*
* Workaround to not require a C++11 compiler for using ULL suffix
* if this code is included and compiled as C++; related GCC warning is:
* warning: use of C++11 long long integer constant [-Wlong-long]
*/
-#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low)
+#define SIP_ULL(high, low) ((((uint64_t)high) << 32) | (low))
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
@@ -126,8 +127,7 @@
| ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) \
| ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))
-#define SIPHASH_INITIALIZER \
- { 0, 0, 0, 0, {0}, 0, 0 }
+#define SIPHASH_INITIALIZER {0, 0, 0, 0, {0}, 0, 0}
struct siphash {
uint64_t v0, v1, v2, v3;
@@ -190,10 +190,10 @@ sip_round(struct siphash *H, const int rounds) {
static struct siphash *
sip24_init(struct siphash *H, const struct sipkey *key) {
- H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];
- H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];
- H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];
- H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1];
+ H->v0 = SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];
+ H->v1 = SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];
+ H->v2 = SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];
+ H->v3 = SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1];
H->p = H->buf;
H->c = 0;
@@ -235,25 +235,25 @@ sip24_final(struct siphash *H) {
switch (left) {
case 7:
b |= (uint64_t)H->buf[6] << 48;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 6:
b |= (uint64_t)H->buf[5] << 40;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 5:
b |= (uint64_t)H->buf[4] << 32;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 4:
b |= (uint64_t)H->buf[3] << 24;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 3:
b |= (uint64_t)H->buf[2] << 16;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 2:
b |= (uint64_t)H->buf[1] << 8;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 1:
b |= (uint64_t)H->buf[0] << 0;
- /* fall through */
+ EXPAT_FALLTHROUGH;
case 0:
break;
}
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/winconfig.h
index 2ecd61b5..05805514 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/winconfig.h
@@ -9,7 +9,8 @@
Copyright (c) 2000 Clark Cooper <coo...@us...>
Copyright (c) 2002 Greg Stein <gs...@us...>
Copyright (c) 2005 Karl Waclawek <ka...@wa...>
- Copyright (c) 2017-2021 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2017-2023 Sebastian Pipping <seb...@pi...>
+ Copyright (c) 2023 Orgad Shaneh <org...@au...>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
@@ -35,7 +36,9 @@
#ifndef WINCONFIG_H
#define WINCONFIG_H
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
diff --git a/3rdparty/expat/winconfig.h b/3rdparty/expat/xcsinc.c
similarity index 75%
copy from 3rdparty/expat/winconfig.h
copy to 3rdparty/expat/xcsinc.c
index 2ecd61b5..3597c248 100644
--- a/3rdparty/expat/winconfig.h
+++ b/3rdparty/expat/xcsinc.c
@@ -1,4 +1,4 @@
-/*
+/* This file is included from other .c files!
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
@@ -6,10 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
- Copyright (c) 2000 Clark Cooper <coo...@us...>
- Copyright (c) 2002 Greg Stein <gs...@us...>
- Copyright (c) 2005 Karl Waclawek <...
[truncated message content] |