git: 330b8d685e58 - stable/15 - contrib/expat: import expat 2.8.3

Philip Paeps <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a851af0.23e65.601e8ffc__19666.2221847632$1787108110$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by philip:

URL: https://cgit.FreeBSD.org/src/commit/?id=330b8d685e585e1c6aa41106dd66a7e4256f2068

commit 330b8d685e585e1c6aa41106dd66a7e4256f2068
Author:     Philip Paeps <[email protected]>
AuthorDate: 2026-08-10 23:30:15 +0000
Commit:     Philip Paeps <[email protected]>
CommitDate: 2026-08-19 01:22:24 +0000

    contrib/expat: import expat 2.8.3
    
    Changes: https://github.com/libexpat/libexpat/blob/R_2_8_3/expat/Changes
    
    Security:       CVE-2026-72522
    
    (cherry picked from commit 207d96dabfec14d7b3699747abb539ab3c1118ab)
---
 contrib/expat/Changes                         | 97 +++++++++++++++++++++------
 contrib/expat/Makefile.am                     |  3 +-
 contrib/expat/Makefile.in                     |  3 +-
 contrib/expat/README.md                       | 14 ++--
 contrib/expat/configure.ac                    |  2 +-
 contrib/expat/doc/reference.html              | 30 ++++++++-
 contrib/expat/doc/xmlwf.1                     |  2 +-
 contrib/expat/doc/xmlwf.xml                   |  2 +-
 contrib/expat/examples/element_declarations.c |  2 +
 contrib/expat/examples/elements.c             |  2 +
 contrib/expat/examples/outline.c              |  2 +
 contrib/expat/lib/ascii.h                     |  2 +
 contrib/expat/lib/asciitab.h                  |  2 +
 contrib/expat/lib/expat.h                     |  4 +-
 contrib/expat/lib/expat_external.h            |  2 +
 contrib/expat/lib/fallthrough.h               |  2 +
 contrib/expat/lib/iasciitab.h                 |  2 +
 contrib/expat/lib/internal.h                  | 17 ++---
 contrib/expat/lib/latin1tab.h                 |  2 +
 contrib/expat/lib/memory_sanitizer.h          |  2 +
 contrib/expat/lib/nametab.h                   |  2 +
 contrib/expat/lib/random_arc4random.c         |  2 +
 contrib/expat/lib/random_arc4random.h         |  2 +
 contrib/expat/lib/random_arc4random_buf.c     |  2 +
 contrib/expat/lib/random_arc4random_buf.h     |  2 +
 contrib/expat/lib/random_dev_urandom.c        |  2 +
 contrib/expat/lib/random_dev_urandom.h        |  2 +
 contrib/expat/lib/random_getentropy.c         |  2 +
 contrib/expat/lib/random_getentropy.h         |  2 +
 contrib/expat/lib/random_getrandom.c          |  2 +
 contrib/expat/lib/random_getrandom.h          |  2 +
 contrib/expat/lib/random_rand_s.c             |  2 +
 contrib/expat/lib/random_rand_s.h             |  2 +
 contrib/expat/lib/siphash.h                   |  2 +
 contrib/expat/lib/utf8tab.h                   |  2 +
 contrib/expat/lib/xcsinc.c                    |  8 ++-
 contrib/expat/lib/xmlparse.c                  | 74 +++++++++++++-------
 contrib/expat/lib/xmlrole.c                   |  2 +
 contrib/expat/lib/xmlrole.h                   |  2 +
 contrib/expat/lib/xmltok.c                    | 17 ++++-
 contrib/expat/lib/xmltok.h                    | 10 ++-
 contrib/expat/lib/xmltok_impl.c               |  2 +
 contrib/expat/lib/xmltok_impl.h               |  2 +
 contrib/expat/lib/xmltok_ns.c                 |  2 +
 contrib/expat/tests/acc_tests.c               |  2 +
 contrib/expat/tests/acc_tests.h               |  2 +
 contrib/expat/tests/alloc_tests.c             |  2 +
 contrib/expat/tests/alloc_tests.h             |  2 +
 contrib/expat/tests/basic_tests.c             | 33 ++++++++-
 contrib/expat/tests/basic_tests.h             |  2 +
 contrib/expat/tests/chardata.c                |  2 +
 contrib/expat/tests/chardata.h                |  2 +
 contrib/expat/tests/common.c                  |  2 +
 contrib/expat/tests/common.h                  |  2 +
 contrib/expat/tests/dummy.c                   |  2 +
 contrib/expat/tests/dummy.h                   |  2 +
 contrib/expat/tests/handlers.c                |  2 +
 contrib/expat/tests/handlers.h                |  2 +
 contrib/expat/tests/memcheck.c                |  2 +
 contrib/expat/tests/memcheck.h                |  2 +
 contrib/expat/tests/minicheck.c               |  2 +
 contrib/expat/tests/minicheck.h               |  2 +
 contrib/expat/tests/misc_tests.c              | 71 +++++++++++++++++++-
 contrib/expat/tests/misc_tests.h              |  2 +
 contrib/expat/tests/ns_tests.c                |  2 +
 contrib/expat/tests/ns_tests.h                |  2 +
 contrib/expat/tests/nsalloc_tests.c           |  2 +
 contrib/expat/tests/nsalloc_tests.h           |  2 +
 contrib/expat/tests/runtests.c                |  2 +
 contrib/expat/tests/structdata.c              |  2 +
 contrib/expat/tests/structdata.h              |  2 +
 contrib/expat/xmlwf/codepage.c                |  2 +
 contrib/expat/xmlwf/codepage.h                |  2 +
 contrib/expat/xmlwf/ct.c                      |  2 +
 contrib/expat/xmlwf/filemap.h                 |  2 +
 contrib/expat/xmlwf/readfilemap.c             |  2 +
 contrib/expat/xmlwf/unixfilemap.c             |  2 +
 contrib/expat/xmlwf/win32filemap.c            |  2 +
 contrib/expat/xmlwf/xmlfile.c                 |  2 +
 contrib/expat/xmlwf/xmlfile.h                 |  2 +
 contrib/expat/xmlwf/xmlmime.c                 |  2 +
 contrib/expat/xmlwf/xmlmime.h                 |  2 +
 contrib/expat/xmlwf/xmltchar.h                |  2 +
 contrib/expat/xmlwf/xmlwf.c                   |  2 +
 contrib/expat/xmlwf/xmlwf_helpgen.py          |  2 +
 contrib/expat/xmlwf/xmlwf_helpgen.sh          |  2 +
 lib/libexpat/expat_config.h                   |  6 +-
 lib/libexpat/libbsdxml.3                      |  4 +-
 88 files changed, 455 insertions(+), 82 deletions(-)

diff --git a/contrib/expat/Changes b/contrib/expat/Changes
index 6a1b89160fb9..ae1b48f3bfd9 100644
--- a/contrib/expat/Changes
+++ b/contrib/expat/Changes
@@ -6,29 +6,82 @@
                                 |_| XML parser
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! <blink>Expat is UNDERSTAFFED and WITHOUT FUNDING.</blink>                 !!
-!!                 ~~~~~~~~~~~~                                              !!
-!! The following topics need *additional skilled C developers* to progress   !!
-!! in a timely manner or at all (loosely ordered by descending priority):    !!
-!!                            _______________________                        !!
-!! - teaming up on fixing the UNFIXED SECURITY ISSUES listed at:             !!
-!!                            """""""""""""""""""""""                        !!
-!!   https://github.com/libexpat/libexpat/issues/1160                        !!
+!! <blink>Expat has UNFIXED SECURITY ISSUES!</blink>                         !!
+!! Please see https://github.com/libexpat/libexpat/issues/1160 for details.  !!
 !!                                                                           !!
-!! - teaming up on researching and fixing future security reports and        !!
-!!   ClusterFuzz findings with few-days-max response times in communication  !!
-!!   in order to (1) have a sound fix ready before the end of a 90 days      !!
-!!   grace period and (2) in a sustainable manner,                           !!
-!!                                                                           !!
-!! - implementing and auto-testing XML 1.0r5 support                         !!
-!!   (needs discussion before pull requests),                                !!
-!!                                                                           !!
-!! For details, please reach out via e-mail to [email protected] so we   !!
-!! can schedule a voice call on the topic, in English or German.             !!
-!!                                                                           !!
-!! THANK YOU!                        Sebastian Pipping -- Berlin, 2026-03-17 !!
+!! Starting 2026-08-01, for up to six months my work maintaining libexpat    !!
+!! will be funded by the City of Munich as part of their                     !!
+!! Open Source Sabbatical (https://opensource.muenchen.de/sabbatical.html)   !!
+!! — thank you!                                                              !!
+!!                                   Sebastian Pipping -- Berlin, 2026-08-03 !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+Release 2.8.3 Mon August 10 2026
+        Security fixes:
+           #1296  CVE-2026-72522 -- Fix an out-of-bounds read and the resulting
+                    infinite loop caused by treating low surrogates (Unicode)
+                    the same as high surrogates in functions *_toUtf16.
+                    Needs Expat compiled with 16bit character support
+                    (e.g. with Firefox and/or on Windows) to be affected.
+                    Upstream CVSS 3.1 vector:
+                    AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (CVSS score: 7.5)
+                    (Note the "AV:N" for network/remote, the "AV:L" in NVD by
+                    Mitre is mistaken.)
+                    Original bug report from Mozilla at:
+                    https://bugzilla.mozilla.org/show_bug.cgi?id=2053153
+
+        Bug fixes:
+     #1297 #1300  lib: Fix support for 2+ GiB documents (regression from 2.8.2)
+           #1286  lib: Reject empty version in the XML declaration
+     #1305 #1306  lib: Fix printf format for AIX
+
+        Other changes:
+           #1309  CMake|AIX: Enable EXPAT_DEV_URANDOM by default for AIX
+           #1295  CMake|Windows: Add a 64bit MinGW toolchain file
+     #1287 #1289  CMake|Windows: Start invoking MSVC with /source-charset:utf-8
+           #1289  CMake|Windows: Start requiring MSVC 2015 Update 2 or later
+           #1300  Document the current wrap-around issues with functions
+                    - XML_GetCurrentByteIndex
+                    - XML_GetCurrentColumnNumber
+                    - XML_GetCurrentLineNumber
+                    - XML_GetAttributeInfo
+                    explicitly.
+           #1303  Address Clang Static Analyzer 22 warning
+                    `core.NullPointerArithm`
+     #1313 #1314  Version info bumped from 13:2:12 (libexpat*.so.1.12.2)
+                    to 13:3:12 (libexpat*.so.1.12.3); see https://verbump.de/
+                    for what these numbers do
+
+        Infrastructure:
+           #1311  CI: Limit workflow runtime and package installation runtime
+           #1310  CI: Pin Cppcheck version for a robust CI
+           #1310  CI: Migrate Cppcheck CI from macOS to Linux
+           #1312  CI: Get CFLAGS and CXXFLAGS back in sync for both Emscripten
+                    and WASI SDK
+           #1304  CI: Activate AddressSanitizer for MSVC Windows CI
+           #1308  CI: Introduce zizmor static analysis for GitHub Actions
+           #1308  CI: Start using `persist-credentials: false` with Git checkout
+           #1219  CI: Add a 7 day cooldown to Dependabot for GitHub Actions
+     #1302 #1303  CI: Bump Clang from 21 to 22
+     #1293 #1294  Update project status for 2026-08
+     #1301 #1307  Add SPDX license identifiers to the source code
+
+        Special thanks to:
+            Evgeny Kotkov
+            Henri Sivonen
+            Kartik Kenchi
+            Matthew Fernandez
+            Matthew Wozniczka
+            Stan Ulbrych
+            Tuukka Pasanen
+            William Woodruff
+                 and
+            Anthropic
+            City of Munich Open Source Sabbatical
+            Mozilla Security Team
+            Subversion
+            zizmor static analysis
+
 Release 2.8.2 Thu June 25 2026
         Security fixes:
            #1246  CVE-2026-50219 -- Disallow calls to functions
@@ -124,6 +177,10 @@ Release 2.8.1 Sun May 10 2026
                     through moderately sized crafted XML input (CWE-407).
                     Please note that a layer of compression around XML can
                     significantly reduce the minimum attack payload size.
+                    Upstream CVSS 3.1 vector:
+                    AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (CVSS score: 7.5)
+                    (Note the "AV:N" for network/remote and the "AC:L"
+                    for low complexity; the NVD entry from Mitre is mistaken.)
 
         Other changes:
      #1209 #1213  Drop more casts related to `void *` that C99 does not need
diff --git a/contrib/expat/Makefile.am b/contrib/expat/Makefile.am
index 72f2fca59d6f..09b88f315165 100644
--- a/contrib/expat/Makefile.am
+++ b/contrib/expat/Makefile.am
@@ -75,7 +75,8 @@ _EXTRA_DIST_CMAKE = \
     cmake/autotools/expat-noconfig__macos.cmake.in \
     cmake/autotools/expat-noconfig__windows.cmake.in \
     cmake/autotools/expat-package-init.cmake \
-    cmake/mingw-toolchain.cmake \
+    cmake/mingw-toolchain-win32.cmake \
+    cmake/mingw-toolchain-win64.cmake \
     \
     CMakeLists.txt \
     CMake.README \
diff --git a/contrib/expat/Makefile.in b/contrib/expat/Makefile.in
index aa41b152525d..0f9a441aa882 100644
--- a/contrib/expat/Makefile.in
+++ b/contrib/expat/Makefile.in
@@ -481,7 +481,8 @@ _EXTRA_DIST_CMAKE = \
     cmake/autotools/expat-noconfig__macos.cmake.in \
     cmake/autotools/expat-noconfig__windows.cmake.in \
     cmake/autotools/expat-package-init.cmake \
-    cmake/mingw-toolchain.cmake \
+    cmake/mingw-toolchain-win32.cmake \
+    cmake/mingw-toolchain-win64.cmake \
     \
     CMakeLists.txt \
     CMake.README \
diff --git a/contrib/expat/README.md b/contrib/expat/README.md
index 5ad5e1e85afa..3e75af77e500 100644
--- a/contrib/expat/README.md
+++ b/contrib/expat/README.md
@@ -6,12 +6,18 @@
 
 > [!CAUTION]
 >
-> Expat is **understaffed** and without funding.
-> There is a [call for help with details](https://github.com/libexpat/libexpat/blob/master/expat/Changes)
-> at the top of the `Changes` file.
+> Expat has **unfixed security issues**!
+> Please see https://github.com/libexpat/libexpat/issues/1160 for details.
+
+> [!NOTE]
+>
+> Starting 2026-08-01, for up to six months my work maintaining libexpat
+> will be funded by the [City of Munich](https://en.wikipedia.org/wiki/Munich)
+> as part of their [Open Source Sabbatical](https://opensource.muenchen.de/software/libexpat.html#open-source-sabbatical).
+> Thank you! :heart: :pray:
 
 
-# Expat, Release 2.8.2
+# Expat, Release 2.8.3
 
 This is Expat, a C99 library for parsing
 [XML 1.0 Fourth Edition](https://www.w3.org/TR/2006/REC-xml-20060816/), started by
diff --git a/contrib/expat/configure.ac b/contrib/expat/configure.ac
index f14c0308e1c4..ce33dd5698c8 100644
--- a/contrib/expat/configure.ac
+++ b/contrib/expat/configure.ac
@@ -90,7 +90,7 @@ dnl If the API changes incompatibly set LIBAGE back to 0
 dnl
 
 LIBCURRENT=13  # sync
-LIBREVISION=2  # with
+LIBREVISION=3  # with
 LIBAGE=12      # CMakeLists.txt!
 
 AC_CONFIG_HEADERS([expat_config.h])
diff --git a/contrib/expat/doc/reference.html b/contrib/expat/doc/reference.html
index 5c4b1c76ca78..022a2a0c043c 100644
--- a/contrib/expat/doc/reference.html
+++ b/contrib/expat/doc/reference.html
@@ -53,7 +53,7 @@
   <body>
     <div>
       <h1>
-        The Expat XML Parser <small>Release 2.8.2</small>
+        The Expat XML Parser <small>Release 2.8.3</small>
       </h1>
     </div>
 
@@ -2917,6 +2917,13 @@ XML_GetCurrentByteIndex(XML_Parser p);
         <code><a href="#XML_GetCurrentColumnNumber">XML_GetCurrentColumnNumber</a></code>.
       </div>
 
+      <p>
+        <strong>Note:</strong> Type <code>XML_Index</code> is known to wrap around on
+        32bit platforms and 64bit Windows unless Expat has been compiled with
+        (non-default and uncommon) macro <code><a href=
+        "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
+      </p>
+
       <h4 id="XML_GetCurrentLineNumber">
         XML_GetCurrentLineNumber
       </h4>
@@ -2930,6 +2937,13 @@ XML_GetCurrentLineNumber(XML_Parser p);
         <code>1</code>.
       </div>
 
+      <p>
+        <strong>Note:</strong> Type <code>XML_Size</code> is known to wrap around on
+        32bit platforms and 64bit Windows unless Expat has been compiled with
+        (non-default and uncommon) macro <code><a href=
+        "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
+      </p>
+
       <h4 id="XML_GetCurrentColumnNumber">
         XML_GetCurrentColumnNumber
       </h4>
@@ -2943,6 +2957,13 @@ XML_GetCurrentColumnNumber(XML_Parser p);
         position. The first column is reported as <code>0</code>.
       </div>
 
+      <p>
+        <strong>Note:</strong> Type <code>XML_Size</code> is known to wrap around on
+        32bit platforms and 64bit Windows unless Expat has been compiled with
+        (non-default and uncommon) macro <code><a href=
+        "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
+      </p>
+
       <h4 id="XML_GetCurrentByteCount">
         XML_GetCurrentByteCount
       </h4>
@@ -3405,6 +3426,13 @@ typedef struct {
         <code>XML_GetSpecifiedAttributeCount(parser) / 2</code>.
       </div>
 
+      <p>
+        <strong>Note:</strong> Type <code>XML_Index</code> is known to wrap around on
+        32bit platforms and 64bit Windows unless Expat has been compiled with
+        (non-default and uncommon) macro <code><a href=
+        "#XML_LARGE_SIZE">XML_LARGE_SIZE</a></code>.
+      </p>
+
       <h4 id="XML_SetEncoding">
         XML_SetEncoding
       </h4>
diff --git a/contrib/expat/doc/xmlwf.1 b/contrib/expat/doc/xmlwf.1
index 3de559ec1bb3..639760bc6be4 100644
--- a/contrib/expat/doc/xmlwf.1
+++ b/contrib/expat/doc/xmlwf.1
@@ -5,7 +5,7 @@
 \\$2 \(la\\$1\(ra\\$3
 ..
 .if \n(.g .mso www.tmac
-.TH XMLWF 1 "June 25, 2026" "" ""
+.TH XMLWF 1 "August 10, 2026" "" ""
 .SH NAME
 xmlwf \- Determines if an XML document is well-formed
 .SH SYNOPSIS
diff --git a/contrib/expat/doc/xmlwf.xml b/contrib/expat/doc/xmlwf.xml
index 7e57cf1346b9..b1b23bee1f6f 100644
--- a/contrib/expat/doc/xmlwf.xml
+++ b/contrib/expat/doc/xmlwf.xml
@@ -21,7 +21,7 @@
           "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
   <!ENTITY dhfirstname "<firstname>Scott</firstname>">
   <!ENTITY dhsurname   "<surname>Bronson</surname>">
-  <!ENTITY dhdate      "<date>June 25, 2026</date>">
+  <!ENTITY dhdate      "<date>August 10, 2026</date>">
   <!-- Please adjust this^^ date whenever cutting a new release. -->
   <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
   <!ENTITY dhemail     "<email>[email protected]</email>">
diff --git a/contrib/expat/examples/element_declarations.c b/contrib/expat/examples/element_declarations.c
index d864cf70a2f7..ea790f4932b4 100644
--- a/contrib/expat/examples/element_declarations.c
+++ b/contrib/expat/examples/element_declarations.c
@@ -37,6 +37,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include <stdbool.h>
diff --git a/contrib/expat/examples/elements.c b/contrib/expat/examples/elements.c
index e5fb850d501b..ef7baeae5646 100644
--- a/contrib/expat/examples/elements.c
+++ b/contrib/expat/examples/elements.c
@@ -37,6 +37,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include <stdio.h>
diff --git a/contrib/expat/examples/outline.c b/contrib/expat/examples/outline.c
index d2df914fedb8..3168fab612cc 100644
--- a/contrib/expat/examples/outline.c
+++ b/contrib/expat/examples/outline.c
@@ -34,6 +34,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include <stdio.h>
diff --git a/contrib/expat/lib/ascii.h b/contrib/expat/lib/ascii.h
index 1f594d2e54b4..1d9cf70bf695 100644
--- a/contrib/expat/lib/ascii.h
+++ b/contrib/expat/lib/ascii.h
@@ -31,6 +31,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #define ASCII_A 0x41
diff --git a/contrib/expat/lib/asciitab.h b/contrib/expat/lib/asciitab.h
index af766fb24785..43af0876ccd3 100644
--- a/contrib/expat/lib/asciitab.h
+++ b/contrib/expat/lib/asciitab.h
@@ -30,6 +30,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
diff --git a/contrib/expat/lib/expat.h b/contrib/expat/lib/expat.h
index c493c70441c4..dbebd985a652 100644
--- a/contrib/expat/lib/expat.h
+++ b/contrib/expat/lib/expat.h
@@ -40,6 +40,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #ifndef Expat_INCLUDED
@@ -1094,7 +1096,7 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
 */
 #  define XML_MAJOR_VERSION 2
 #  define XML_MINOR_VERSION 8
-#  define XML_MICRO_VERSION 2
+#  define XML_MICRO_VERSION 3
 
 #  ifdef __cplusplus
 }
diff --git a/contrib/expat/lib/expat_external.h b/contrib/expat/lib/expat_external.h
index 7f5c4c3aae4d..4cd1f3a49c35 100644
--- a/contrib/expat/lib/expat_external.h
+++ b/contrib/expat/lib/expat_external.h
@@ -36,6 +36,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #ifndef Expat_External_INCLUDED
diff --git a/contrib/expat/lib/fallthrough.h b/contrib/expat/lib/fallthrough.h
index 707dbdd44bfe..0152d1bdc5de 100644
--- a/contrib/expat/lib/fallthrough.h
+++ b/contrib/expat/lib/fallthrough.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #ifndef FALLTHROUGH_H
diff --git a/contrib/expat/lib/iasciitab.h b/contrib/expat/lib/iasciitab.h
index 5d8646f2a318..1de8d519c8b7 100644
--- a/contrib/expat/lib/iasciitab.h
+++ b/contrib/expat/lib/iasciitab.h
@@ -30,6 +30,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
diff --git a/contrib/expat/lib/internal.h b/contrib/expat/lib/internal.h
index 420d4217a569..7e67d2e378c5 100644
--- a/contrib/expat/lib/internal.h
+++ b/contrib/expat/lib/internal.h
@@ -53,6 +53,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if defined(__GNUC__) && defined(__i386__) && ! defined(__MINGW32__)
@@ -123,20 +125,11 @@
 #    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
 #  endif
 #else
+#  include <inttypes.h> // PRIdPTR, PRIuPTR
 #  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"
-#  endif
+#  define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart PRIdPTR
+#  define EXPAT_FMT_SIZE_T(midpart) "%" midpart PRIuPTR
 #endif
 
 #ifndef UNUSED_P
diff --git a/contrib/expat/lib/latin1tab.h b/contrib/expat/lib/latin1tab.h
index b681d278af65..3793f4f3cc78 100644
--- a/contrib/expat/lib/latin1tab.h
+++ b/contrib/expat/lib/latin1tab.h
@@ -30,6 +30,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
diff --git a/contrib/expat/lib/memory_sanitizer.h b/contrib/expat/lib/memory_sanitizer.h
index a8a8006ccded..f739b88f3048 100644
--- a/contrib/expat/lib/memory_sanitizer.h
+++ b/contrib/expat/lib/memory_sanitizer.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(MEMORY_SANITIZER_H)
diff --git a/contrib/expat/lib/nametab.h b/contrib/expat/lib/nametab.h
index 63485446b967..2385851562e7 100644
--- a/contrib/expat/lib/nametab.h
+++ b/contrib/expat/lib/nametab.h
@@ -28,6 +28,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 static const unsigned namingBitmap[] = {
diff --git a/contrib/expat/lib/random_arc4random.c b/contrib/expat/lib/random_arc4random.c
index 243fbbc82fda..5405fef2d0ca 100644
--- a/contrib/expat/lib/random_arc4random.c
+++ b/contrib/expat/lib/random_arc4random.c
@@ -28,6 +28,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include "random_arc4random.h"
diff --git a/contrib/expat/lib/random_arc4random.h b/contrib/expat/lib/random_arc4random.h
index 54fbd4c4d38e..c935e97b0023 100644
--- a/contrib/expat/lib/random_arc4random.h
+++ b/contrib/expat/lib/random_arc4random.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(RANDOM_ACR4RANDOM_H)
diff --git a/contrib/expat/lib/random_arc4random_buf.c b/contrib/expat/lib/random_arc4random_buf.c
index 5212b9f192ce..359710339804 100644
--- a/contrib/expat/lib/random_arc4random_buf.c
+++ b/contrib/expat/lib/random_arc4random_buf.c
@@ -28,6 +28,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include "random_arc4random_buf.h"
diff --git a/contrib/expat/lib/random_arc4random_buf.h b/contrib/expat/lib/random_arc4random_buf.h
index 51f7a31f2859..1b4620ec0404 100644
--- a/contrib/expat/lib/random_arc4random_buf.h
+++ b/contrib/expat/lib/random_arc4random_buf.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(RANDOM_ACR4RANDOM_BUF_H)
diff --git a/contrib/expat/lib/random_dev_urandom.c b/contrib/expat/lib/random_dev_urandom.c
index acae6ba4b047..9353fbbdf9db 100644
--- a/contrib/expat/lib/random_dev_urandom.c
+++ b/contrib/expat/lib/random_dev_urandom.c
@@ -28,6 +28,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include "random_dev_urandom.h"
diff --git a/contrib/expat/lib/random_dev_urandom.h b/contrib/expat/lib/random_dev_urandom.h
index d9cf767bff08..0b4774d1cce3 100644
--- a/contrib/expat/lib/random_dev_urandom.h
+++ b/contrib/expat/lib/random_dev_urandom.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(RANDOM_DEV_URANDOM_H)
diff --git a/contrib/expat/lib/random_getentropy.c b/contrib/expat/lib/random_getentropy.c
index 5cea2d8838b9..d258df6a7678 100644
--- a/contrib/expat/lib/random_getentropy.c
+++ b/contrib/expat/lib/random_getentropy.c
@@ -28,6 +28,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include "random_getentropy.h"
diff --git a/contrib/expat/lib/random_getentropy.h b/contrib/expat/lib/random_getentropy.h
index a00b16bfb33d..123e75070254 100644
--- a/contrib/expat/lib/random_getentropy.h
+++ b/contrib/expat/lib/random_getentropy.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(RANDOM_GETENTROPY_H)
diff --git a/contrib/expat/lib/random_getrandom.c b/contrib/expat/lib/random_getrandom.c
index 72e2cc7093be..79ae670c7f32 100644
--- a/contrib/expat/lib/random_getrandom.c
+++ b/contrib/expat/lib/random_getrandom.c
@@ -30,6 +30,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include "expat_config.h" // for HAVE_GETRANDOM, HAVE_SYSCALL_GETRANDOM
diff --git a/contrib/expat/lib/random_getrandom.h b/contrib/expat/lib/random_getrandom.h
index ed4d829cd0d6..423b97cad9f8 100644
--- a/contrib/expat/lib/random_getrandom.h
+++ b/contrib/expat/lib/random_getrandom.h
@@ -27,6 +27,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(RANDOM_GETRANDOM_H)
diff --git a/contrib/expat/lib/random_rand_s.c b/contrib/expat/lib/random_rand_s.c
index 46156563c91c..4001ce6cf182 100644
--- a/contrib/expat/lib/random_rand_s.c
+++ b/contrib/expat/lib/random_rand_s.c
@@ -31,6 +31,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #include "random_rand_s.h"
diff --git a/contrib/expat/lib/random_rand_s.h b/contrib/expat/lib/random_rand_s.h
index 2b487d62a7c5..461fc6086963 100644
--- a/contrib/expat/lib/random_rand_s.h
+++ b/contrib/expat/lib/random_rand_s.h
@@ -28,6 +28,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #if ! defined(RANDOM_RAND_S_H)
diff --git a/contrib/expat/lib/siphash.h b/contrib/expat/lib/siphash.h
index be216b4006dc..ac1fbfaf0bde 100644
--- a/contrib/expat/lib/siphash.h
+++ b/contrib/expat/lib/siphash.h
@@ -8,6 +8,8 @@
  *
  * 1. https://www.131002.net/siphash/siphash24.c
  * 2. https://www.131002.net/siphash/
+ *
+ * SPDX-License-Identifier: CC0-1.0
  * --------------------------------------------------------------------------
  * HISTORY:
  *
diff --git a/contrib/expat/lib/utf8tab.h b/contrib/expat/lib/utf8tab.h
index 88efcf91cc16..73732d1527f1 100644
--- a/contrib/expat/lib/utf8tab.h
+++ b/contrib/expat/lib/utf8tab.h
@@ -30,6 +30,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
diff --git a/contrib/expat/lib/xcsinc.c b/contrib/expat/lib/xcsinc.c
index 3597c2480bc9..675b2844c708 100644
--- a/contrib/expat/lib/xcsinc.c
+++ b/contrib/expat/lib/xcsinc.c
@@ -6,7 +6,7 @@
                         \___/_/\_\ .__/ \__,_|\__|
                                  |_| XML parser
 
-   Copyright (c) 2022 Sebastian Pipping <[email protected]>
+   Copyright (c) 2022-2026 Sebastian Pipping <[email protected]>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -27,8 +27,14 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
+#if defined(XML_UNICODE) && defined(XML_UNICODE_WCHAR_T)
+#  include <wchar.h>
+#endif
+
 static size_t
 xcslen(const XML_Char *s) {
 #ifdef XML_UNICODE
diff --git a/contrib/expat/lib/xmlparse.c b/contrib/expat/lib/xmlparse.c
index 60f6cc700548..ac79b9ce7a3b 100644
--- a/contrib/expat/lib/xmlparse.c
+++ b/contrib/expat/lib/xmlparse.c
@@ -1,4 +1,4 @@
-/* 5de44e6750c6cc78818f06ed552f522a1241df0299395250e1792cb339389daf (2.8.2+)
+/* ee5f82c3ffd57c5224394ba46f348dbce466d34d6c925a527ae46b1cfe6adf1d (2.8.3+)
                             __  __            _
                          ___\ \/ /_ __   __ _| |_
                         / _ \\  /| '_ \ / _` | __|
@@ -50,6 +50,7 @@
    Copyright (c) 2026      Nick Begg <[email protected]>
    Copyright (c) 2026      Kartik Kenchi <[email protected]>
    Copyright (c) 2026      Haris Hussain <[email protected]>
+   Copyright (c) 2026      Evgeny Kotkov <[email protected]>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -70,6 +71,8 @@
    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.
+
+   SPDX-License-Identifier: MIT
 */
 
 #define XML_BUILDING_EXPAT 1
@@ -93,10 +96,10 @@
 #include <stddef.h>
 #include <string.h> /* memset(), memcpy() */
 #include <assert.h>
-#include <limits.h> /* INT_MAX, LLONG_MAX, LONG_MAX, UINT_MAX */
+#include <limits.h> /* INT_MAX, UINT_MAX */
 #include <stdio.h>  /* fprintf */
 #include <stdlib.h> /* getenv */
-#include <stdint.h> /* SIZE_MAX, uintptr_t */
+#include <stdint.h> /* SIZE_MAX, UINT64_MAX, uint64_t, uintptr_t */
 #include <math.h>   /* isnan */
 #include <errno.h>
 
@@ -211,12 +214,6 @@ typedef char ICHAR;
 
 #endif
 
-#ifdef XML_LARGE_SIZE
-#  define XML_INDEX_MAX LLONG_MAX
-#else
-#  define XML_INDEX_MAX LONG_MAX
-#endif
-
 /* Round up n to be a multiple of sz, where sz is a power of 2. */
 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
 
@@ -719,7 +716,7 @@ struct XML_ParserStruct {
   char *m_bufferEnd;       // past last character to be parsed
   const char *m_bufferLim; // allocated end of m_buffer
 
-  XML_Index m_parseEndByteIndex;
+  uint64_t m_parseEndByteIndex;
   const char *m_parseEndPtr;
   size_t m_partialTokenBytesBefore; /* used in heuristic to avoid O(n^2) */
   XML_Bool m_reparseDeferralEnabled;
@@ -2312,7 +2309,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) {
     int nLeftOver;
     enum XML_Status result;
     /* Detect overflow (a+b > MAX <==> b > MAX-a) */
-    if (len > XML_INDEX_MAX - parser->m_parseEndByteIndex) {
+    if ((uint64_t)len > UINT64_MAX - parser->m_parseEndByteIndex) {
       parser->m_errorCode = XML_ERROR_NO_MEMORY;
       parser->m_eventPtr = parser->m_eventEndPtr = NULL;
       parser->m_processor = errorProcessor;
@@ -2430,7 +2427,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) {
   }
 
   // Detect and avoid integer overflow
-  if (len > XML_INDEX_MAX - parser->m_parseEndByteIndex) {
+  if ((uint64_t)len > UINT64_MAX - parser->m_parseEndByteIndex) {
     parser->m_errorCode = XML_ERROR_NO_MEMORY;
     parser->m_eventPtr = parser->m_eventEndPtr = NULL;
     parser->m_processor = errorProcessor;
@@ -2692,9 +2689,15 @@ XML_Index XMLCALL
 XML_GetCurrentByteIndex(XML_Parser parser) {
   if (parser == NULL)
     return -1;
-  if (parser->m_eventPtr)
+  if (parser->m_eventPtr) {
+    // NOTE: XML_Index is known to wrap around for >2 GiB content
+    //       on 32bit machines and 64bit Windows, unless (non-default and
+    //       uncommon) XML_LARGE_SIZE is defined.
+    //       That's a bug and it only lives on because we cannot break
+    //       ABI compatibility of public API.
     return (XML_Index)(parser->m_parseEndByteIndex
                        - (parser->m_parseEndPtr - parser->m_eventPtr));
+  }
   return -1;
 }
 
@@ -2736,7 +2739,12 @@ XML_GetCurrentLineNumber(XML_Parser parser) {
                       parser->m_eventPtr, &parser->m_position);
     parser->m_positionPtr = parser->m_eventPtr;
   }
-  return parser->m_position.lineNumber + 1;
+  // NOTE: XML_Size is known to wrap around for >2 4iB content
+  //       on 32bit machines and 64bit Windows, unless (non-default and
+  //       uncommon) XML_LARGE_SIZE is defined.
+  //       That's a bug and it only lives on because we cannot break
+  //       ABI compatibility of public API.
+  return (XML_Size)(parser->m_position.lineNumber + 1);
 }
 
 XML_Size XMLCALL
@@ -2748,7 +2756,12 @@ XML_GetCurrentColumnNumber(XML_Parser parser) {
                       parser->m_eventPtr, &parser->m_position);
     parser->m_positionPtr = parser->m_eventPtr;
   }
-  return parser->m_position.columnNumber;
+  // NOTE: XML_Size is known to wrap around for >2 4iB content
+  //       on 32bit machines and 64bit Windows, unless (non-default and
+  //       uncommon) XML_LARGE_SIZE is defined.
+  //       That's a bug and it only lives on because we cannot break
+  //       ABI compatibility of public API.
+  return (XML_Size)parser->m_position.columnNumber;
 }
 
 void XMLCALL
@@ -3905,14 +3918,22 @@ storeAtts(XML_Parser parser, const ENCODING *enc, const char *attStr,
     if (! attId)
       return XML_ERROR_NO_MEMORY;
 #ifdef XML_ATTR_INFO
+    // NOTE: XML_Index is known to wrap around for >2 GiB content
+    //       on 32bit machines and 64bit Windows, unless (non-default and
+    //       uncommon) XML_LARGE_SIZE is defined.
+    //       That's a bug and it only lives on because we cannot break
+    //       ABI compatibility of public API.
     currAttInfo->nameStart
-        = parser->m_parseEndByteIndex - (parser->m_parseEndPtr - currAtt->name);
+        = (XML_Index)(parser->m_parseEndByteIndex
+                      - (parser->m_parseEndPtr - currAtt->name));
     currAttInfo->nameEnd
         = currAttInfo->nameStart + XmlNameLength(enc, currAtt->name);
-    currAttInfo->valueStart = parser->m_parseEndByteIndex
-                              - (parser->m_parseEndPtr - currAtt->valuePtr);
-    currAttInfo->valueEnd = parser->m_parseEndByteIndex
-                            - (parser->m_parseEndPtr - currAtt->valueEnd);
+    currAttInfo->valueStart
+        = (XML_Index)(parser->m_parseEndByteIndex
+                      - (parser->m_parseEndPtr - currAtt->valuePtr));
+    currAttInfo->valueEnd
+        = (XML_Index)(parser->m_parseEndByteIndex
+                      - (parser->m_parseEndPtr - currAtt->valueEnd));
 #endif
     /* Detect duplicate attributes by their QNames. This does not work when
        namespace processing is turned on and different prefixes for the same
@@ -6554,11 +6575,12 @@ storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
         // Check if entity is complete, if not, mark down how much of it is
         // processed. A XML_SUSPENDED check here is not required as
         // appendAttributeValue will never suspend the parser.
-        if (textEnd != nextInEntity) {
+        if (nextInEntity < textEnd) {
           entity->processed
               = (int)(nextInEntity - (const char *)entity->textPtr);
           continue;
         }
+        assert(nextInEntity == textEnd);
 
         // Entity is complete. We cannot close it here since we need to first
         // process its possible inner entities (which are added to the
@@ -8192,7 +8214,7 @@ poolGrow(STRING_POOL *pool) {
       pool->freeBlocks = tem;
       memcpy(pool->blocks->s, pool->start,
              (pool->end - pool->start) * sizeof(XML_Char));
-      pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
+      pool->ptr = pool->blocks->s + EXPAT_SAFE_PTR_DIFF(pool->ptr, pool->start);
       pool->start = pool->blocks->s;
       pool->end = pool->start + pool->blocks->size;
       return XML_TRUE;
@@ -8205,7 +8227,8 @@ poolGrow(STRING_POOL *pool) {
 
     /* NOTE: Needs to be calculated prior to calling `realloc`
              to avoid dangling pointers: */
-    const ptrdiff_t offsetInsideBlock = pool->ptr - pool->start;
+    const ptrdiff_t offsetInsideBlock
+        = EXPAT_SAFE_PTR_DIFF(pool->ptr, pool->start);
 
     if (blockSize < 0) {
       /* This condition traps a situation where either more than
*** 947 LINES SKIPPED ***
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.