Skip to content

Commit 1e7aa36

Browse files
Upgrade bundled Expat to 2.7.5
1 parent 6f8867a commit 1e7aa36

File tree

9 files changed

+79
-35
lines changed

9 files changed

+79
-35
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update bundled `libexpat <https://libexpat.github.io/>`_ to version 2.7.5.

Misc/sbom.spdx.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/expat/expat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
10821082
*/
10831083
# define XML_MAJOR_VERSION 2
10841084
# define XML_MINOR_VERSION 7
1085-
# define XML_MICRO_VERSION 4
1085+
# define XML_MICRO_VERSION 5
10861086

10871087
# ifdef __cplusplus
10881088
}

Modules/expat/expat_external.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
1313
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
1414
Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
15-
Copyright (c) 2016-2025 Sebastian Pipping <sebastian@pipping.org>
15+
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
1616
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
1717
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
1818
Licensed under the MIT license:

Modules/expat/refresh.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ fi
1212

1313
# Update this when updating to a new version after verifying that the changes
1414
# the update brings in are good. These values are used for verifying the SBOM, too.
15-
expected_libexpat_tag="R_2_7_4"
16-
expected_libexpat_version="2.7.4"
17-
expected_libexpat_sha256="461ecc8aa98ab1a68c2db788175665d1a4db640dc05bf0e289b6ea17122144ec"
15+
expected_libexpat_tag="R_2_7_5"
16+
expected_libexpat_version="2.7.5"
17+
expected_libexpat_sha256="9931f9860d18e6cf72d183eb8f309bfb96196c00e1d40caa978e95bc9aa978b6"
1818

1919
expat_dir="$(realpath "$(dirname -- "${BASH_SOURCE[0]}")")"
2020
cd ${expat_dir}

Modules/expat/xmlparse.c

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* fab937ab8b186d7d296013669c332e6dfce2f99567882cff1f8eb24223c524a7 (2.7.4+)
1+
/* 93c1caa66e2b0310459482516af05505b57c5cb7b96df777105308fc585c85d1 (2.7.5+)
22
__ __ _
33
___\ \/ /_ __ __ _| |_
44
/ _ \\ /| '_ \ / _` | __|
@@ -590,6 +590,8 @@ static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
590590
static XML_Bool FASTCALL poolGrow(STRING_POOL *pool);
591591
static const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool,
592592
const XML_Char *s);
593+
static const XML_Char *FASTCALL poolCopyStringNoFinish(STRING_POOL *pool,
594+
const XML_Char *s);
593595
static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s,
594596
int n);
595597
static const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool,
@@ -5086,7 +5088,7 @@ entityValueInitProcessor(XML_Parser parser, const char *s, const char *end,
50865088
}
50875089
/* If we get this token, we have the start of what might be a
50885090
normal tag, but not a declaration (i.e. it doesn't begin with
5089-
"<!"). In a DTD context, that isn't legal.
5091+
"<!" or "<?"). In a DTD context, that isn't legal.
50905092
*/
50915093
else if (tok == XML_TOK_INSTANCE_START) {
50925094
*nextPtr = next;
@@ -5175,6 +5177,15 @@ entityValueProcessor(XML_Parser parser, const char *s, const char *end,
51755177
/* found end of entity value - can store it now */
51765178
return storeEntityValue(parser, enc, s, end, XML_ACCOUNT_DIRECT, NULL);
51775179
}
5180+
/* If we get this token, we have the start of what might be a
5181+
normal tag, but not a declaration (i.e. it doesn't begin with
5182+
"<!" or "<?"). In a DTD context, that isn't legal.
5183+
*/
5184+
else if (tok == XML_TOK_INSTANCE_START) {
5185+
*nextPtr = next;
5186+
return XML_ERROR_SYNTAX;
5187+
}
5188+
51785189
start = next;
51795190
}
51805191
}
@@ -6789,7 +6800,14 @@ storeEntityValue(XML_Parser parser, const ENCODING *enc,
67896800
return XML_ERROR_NO_MEMORY;
67906801
}
67916802

6792-
const char *next;
6803+
const char *next = entityTextPtr;
6804+
6805+
/* Nothing to tokenize. */
6806+
if (entityTextPtr >= entityTextEnd) {
6807+
result = XML_ERROR_NONE;
6808+
goto endEntityValue;
6809+
}
6810+
67936811
for (;;) {
67946812
next
67956813
= entityTextPtr; /* XmlEntityValueTok doesn't always set the last arg */
@@ -7439,16 +7457,24 @@ setContext(XML_Parser parser, const XML_Char *context) {
74397457
else {
74407458
if (! poolAppendChar(&parser->m_tempPool, XML_T('\0')))
74417459
return XML_FALSE;
7442-
prefix
7443-
= (PREFIX *)lookup(parser, &dtd->prefixes,
7444-
poolStart(&parser->m_tempPool), sizeof(PREFIX));
7445-
if (! prefix)
7460+
const XML_Char *const prefixName = poolCopyStringNoFinish(
7461+
&dtd->pool, poolStart(&parser->m_tempPool));
7462+
if (! prefixName) {
74467463
return XML_FALSE;
7447-
if (prefix->name == poolStart(&parser->m_tempPool)) {
7448-
prefix->name = poolCopyString(&dtd->pool, prefix->name);
7449-
if (! prefix->name)
7450-
return XML_FALSE;
74517464
}
7465+
7466+
prefix = (PREFIX *)lookup(parser, &dtd->prefixes, prefixName,
7467+
sizeof(PREFIX));
7468+
7469+
const bool prefixNameUsed = prefix && prefix->name == prefixName;
7470+
if (prefixNameUsed)
7471+
poolFinish(&dtd->pool);
7472+
else
7473+
poolDiscard(&dtd->pool);
7474+
7475+
if (! prefix)
7476+
return XML_FALSE;
7477+
74527478
poolDiscard(&parser->m_tempPool);
74537479
}
74547480
for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0');
@@ -8036,6 +8062,23 @@ poolCopyString(STRING_POOL *pool, const XML_Char *s) {
80368062
return s;
80378063
}
80388064

8065+
// A version of `poolCopyString` that does not call `poolFinish`
8066+
// and reverts any partial advancement upon failure.
8067+
static const XML_Char *FASTCALL
8068+
poolCopyStringNoFinish(STRING_POOL *pool, const XML_Char *s) {
8069+
const XML_Char *const original = s;
8070+
do {
8071+
if (! poolAppendChar(pool, *s)) {
8072+
// Revert any previously successful advancement
8073+
const ptrdiff_t advancedBy = s - original;
8074+
if (advancedBy > 0)
8075+
pool->ptr -= advancedBy;
8076+
return NULL;
8077+
}
8078+
} while (*s++);
8079+
return pool->start;
8080+
}
8081+
80398082
static const XML_Char *
80408083
poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) {
80418084
if (! pool->ptr && ! poolGrow(pool)) {

Modules/expat/xmlrole.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
1313
Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
1414
Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
15-
Copyright (c) 2016-2023 Sebastian Pipping <sebastian@pipping.org>
15+
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
1616
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
1717
Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
1818
Copyright (c) 2021 Donghee Na <donghee.na@python.org>

Modules/expat/xmltok.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
1313
Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
1414
Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
15-
Copyright (c) 2016-2024 Sebastian Pipping <sebastian@pipping.org>
15+
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
1616
Copyright (c) 2016 Pascal Cuoq <cuoq@trust-in-soft.com>
1717
Copyright (c) 2016 Don Lewis <truckman@apache.org>
1818
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>

Modules/expat/xmltok_ns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
1212
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
1313
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
14-
Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
14+
Copyright (c) 2017-2026 Sebastian Pipping <sebastian@pipping.org>
1515
Copyright (c) 2025 Alfonso Gregory <gfunni234@gmail.com>
1616
Licensed under the MIT license:
1717

0 commit comments

Comments
 (0)