Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Update bundled `libexpat <https://libexpat.github.io/>`_ to version 2.8.3
for the fix to `CVE-2026-72522 <https://www.cve.org/CVERecord?id=CVE-2026-72522>`_.
2 changes: 2 additions & 0 deletions Modules/expat/ascii.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/asciitab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion Modules/expat/expat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/expat_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/fallthrough.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/iasciitab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
17 changes: 5 additions & 12 deletions Modules/expat/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/latin1tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/memory_sanitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/nametab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
6 changes: 3 additions & 3 deletions Modules/expat/refresh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ fi

# Update this when updating to a new version after verifying that the changes
# the update brings in are good. These values are used for verifying the SBOM, too.
expected_libexpat_tag="R_2_8_2"
expected_libexpat_version="2.8.2"
expected_libexpat_sha256="ef7d1994f533c9e7343d6c19f31064fc8ebbcbcaa144be3812b4f43052a05f4c"
expected_libexpat_tag="R_2_8_3"
expected_libexpat_version="2.8.3"
expected_libexpat_sha256="22920a86c83f32300b11463635b71f11137a917975af297725e55525027d4e50"

expat_dir="$(realpath "$(dirname -- "${BASH_SOURCE[0]}")")"
cd ${expat_dir}
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/siphash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/utf8tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/winconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

#ifndef WINCONFIG_H
Expand Down
8 changes: 7 additions & 1 deletion Modules/expat/xcsinc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser

Copyright (c) 2022 Sebastian Pipping <sebastian@pipping.org>
Copyright (c) 2022-2026 Sebastian Pipping <sebastian@pipping.org>
Licensed under the MIT license:

Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -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
Expand Down
74 changes: 49 additions & 25 deletions Modules/expat/xmlparse.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* 5de44e6750c6cc78818f06ed552f522a1241df0299395250e1792cb339389daf (2.8.2+)
/* ee5f82c3ffd57c5224394ba46f348dbce466d34d6c925a527ae46b1cfe6adf1d (2.8.3+)
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
Expand Down Expand Up @@ -50,6 +50,7 @@
Copyright (c) 2026 Nick Begg <nick@stunttruck.net>
Copyright (c) 2026 Kartik Kenchi <netliomax25@gmail.com>
Copyright (c) 2026 Haris Hussain <hextheshadow0x@gmail.com>
Copyright (c) 2026 Evgeny Kotkov <kotkov@apache.org>
Licensed under the MIT license:

Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -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
Expand All @@ -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>

Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -8268,8 +8291,9 @@ poolGrow(STRING_POOL *pool) {
tem->next = pool->blocks;
pool->blocks = tem;
if (pool->ptr != pool->start)
memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char));
pool->ptr = tem->s + (pool->ptr - pool->start);
memcpy(tem->s, pool->start,
EXPAT_SAFE_PTR_DIFF(pool->ptr, pool->start) * sizeof(XML_Char));
pool->ptr = tem->s + EXPAT_SAFE_PTR_DIFF(pool->ptr, pool->start);
pool->start = tem->s;
pool->end = tem->s + blockSize;
}
Expand Down
2 changes: 2 additions & 0 deletions Modules/expat/xmlrole.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 "expat_config.h"
Expand Down
Loading
Loading