Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f791cda

Browse filesBrowse files
authored
[3.8] gh-116741: Upgrade libexpat to 2.6.2 (GH-117296) (GH-118188)
(cherry picked from commit c9829ee)
1 parent 14ac620 commit f791cda
Copy full SHA for f791cda

File tree

4 files changed

+37
-16
lines changed
Filter options

4 files changed

+37
-16
lines changed
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update bundled libexpat to 2.6.2

‎Modules/expat/expat.h

Copy file name to clipboardExpand all lines: Modules/expat/expat.h
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Copyright (c) 2022 Thijs Schreijer <thijs@thijsschreijer.nl>
1919
Copyright (c) 2023 Hanno Böck <hanno@gentoo.org>
2020
Copyright (c) 2023 Sony Corporation / Snild Dolkow <snild@sony.com>
21+
Copyright (c) 2024 Taichi Haradaguchi <20001722@ymail.ne.jp>
2122
Licensed under the MIT license:
2223
2324
Permission is hereby granted, free of charge, to any person obtaining
@@ -1042,7 +1043,7 @@ typedef struct {
10421043
XMLPARSEAPI(const XML_Feature *)
10431044
XML_GetFeatureList(void);
10441045

1045-
#if XML_GE == 1
1046+
#if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
10461047
/* Added in Expat 2.4.0 for XML_DTD defined and
10471048
* added in Expat 2.6.0 for XML_GE == 1. */
10481049
XMLPARSEAPI(XML_Bool)
@@ -1065,7 +1066,7 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
10651066
*/
10661067
#define XML_MAJOR_VERSION 2
10671068
#define XML_MINOR_VERSION 6
1068-
#define XML_MICRO_VERSION 0
1069+
#define XML_MICRO_VERSION 2
10691070

10701071
#ifdef __cplusplus
10711072
}

‎Modules/expat/internal.h

Copy file name to clipboardExpand all lines: Modules/expat/internal.h
+12-5Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
2929
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
3030
Copyright (c) 2003 Greg Stein <gstein@users.sourceforge.net>
31-
Copyright (c) 2016-2023 Sebastian Pipping <sebastian@pipping.org>
31+
Copyright (c) 2016-2024 Sebastian Pipping <sebastian@pipping.org>
3232
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
3333
Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
34-
Copyright (c) 2023 Sony Corporation / Snild Dolkow <snild@sony.com>
34+
Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com>
35+
Copyright (c) 2024 Taichi Haradaguchi <20001722@ymail.ne.jp>
3536
Licensed under the MIT license:
3637
3738
Permission is hereby granted, free of charge, to any person obtaining
@@ -155,14 +156,20 @@ extern "C" {
155156
void _INTERNAL_trim_to_complete_utf8_characters(const char *from,
156157
const char **fromLimRef);
157158

158-
#if XML_GE == 1
159+
#if defined(XML_GE) && XML_GE == 1
159160
unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser);
160161
unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser);
161162
const char *unsignedCharToPrintable(unsigned char c);
162163
#endif
163164

164-
extern XML_Bool g_reparseDeferralEnabledDefault; // written ONLY in runtests.c
165-
extern unsigned int g_parseAttempts; // used for testing only
165+
extern
166+
#if ! defined(XML_TESTING)
167+
const
168+
#endif
169+
XML_Bool g_reparseDeferralEnabledDefault; // written ONLY in runtests.c
170+
#if defined(XML_TESTING)
171+
extern unsigned int g_bytesScanned; // used for testing only
172+
#endif
166173

167174
#ifdef __cplusplus
168175
}

‎Modules/expat/xmlparse.c

Copy file name to clipboardExpand all lines: Modules/expat/xmlparse.c
+21-9Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* 628e24d4966bedbd4800f6ed128d06d29703765b4bce12d3b7f099f90f842fc9 (2.6.0+)
1+
/* 2a14271ad4d35e82bde8ba210b4edb7998794bcbae54deab114046a300f9639a (2.6.2+)
22
__ __ _
33
___\ \/ /_ __ __ _| |_
44
/ _ \\ /| '_ \ / _` | __|
@@ -38,7 +38,7 @@
3838
Copyright (c) 2022 Jann Horn <jannh@google.com>
3939
Copyright (c) 2022 Sean McBride <sean@rogue-research.com>
4040
Copyright (c) 2023 Owain Davies <owaind@bath.edu>
41-
Copyright (c) 2023 Sony Corporation / Snild Dolkow <snild@sony.com>
41+
Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com>
4242
Licensed under the MIT license:
4343
4444
Permission is hereby granted, free of charge, to any person obtaining
@@ -210,7 +210,7 @@ typedef char ICHAR;
210210
#endif
211211

212212
/* Round up n to be a multiple of sz, where sz is a power of 2. */
213-
#define ROUND_UP(n, sz) (((n) + ((sz)-1)) & ~((sz)-1))
213+
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
214214

215215
/* Do safe (NULL-aware) pointer arithmetic */
216216
#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)
@@ -248,7 +248,7 @@ static void copy_salt_to_sipkey(XML_Parser parser, struct sipkey *key);
248248
it odd, since odd numbers are always relative prime to a power of 2.
249249
*/
250250
#define SECOND_HASH(hash, mask, power) \
251-
((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2))
251+
((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2))
252252
#define PROBE_STEP(hash, mask, power) \
253253
((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
254254

@@ -629,8 +629,14 @@ static unsigned long getDebugLevel(const char *variableName,
629629
? 0 \
630630
: ((*((pool)->ptr)++ = c), 1))
631631

632-
XML_Bool g_reparseDeferralEnabledDefault = XML_TRUE; // write ONLY in runtests.c
633-
unsigned int g_parseAttempts = 0; // used for testing only
632+
#if ! defined(XML_TESTING)
633+
const
634+
#endif
635+
XML_Bool g_reparseDeferralEnabledDefault
636+
= XML_TRUE; // write ONLY in runtests.c
637+
#if defined(XML_TESTING)
638+
unsigned int g_bytesScanned = 0; // used for testing only
639+
#endif
634640

635641
struct XML_ParserStruct {
636642
/* The first member must be m_userData so that the XML_GetUserData
@@ -1017,7 +1023,9 @@ callProcessor(XML_Parser parser, const char *start, const char *end,
10171023
return XML_ERROR_NONE;
10181024
}
10191025
}
1020-
g_parseAttempts += 1;
1026+
#if defined(XML_TESTING)
1027+
g_bytesScanned += (unsigned)have_now;
1028+
#endif
10211029
const enum XML_Error ret = parser->m_processor(parser, start, end, endPtr);
10221030
if (ret == XML_ERROR_NONE) {
10231031
// if we consumed nothing, remember what we had on this parse attempt.
@@ -6232,7 +6240,7 @@ storeEntityValue(XML_Parser parser, const ENCODING *enc,
62326240
dtd->keepProcessing = dtd->standalone;
62336241
goto endEntityValue;
62346242
}
6235-
if (entity->open) {
6243+
if (entity->open || (entity == parser->m_declEntity)) {
62366244
if (enc == parser->m_encoding)
62376245
parser->m_eventPtr = entityTextPtr;
62386246
result = XML_ERROR_RECURSIVE_ENTITY_REF;
@@ -7779,14 +7787,18 @@ copyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) {
77797787

77807788
static float
77817789
accountingGetCurrentAmplification(XML_Parser rootParser) {
7790+
// 1.........1.........12 => 22
7791+
const size_t lenOfShortestInclude = sizeof("<!ENTITY a SYSTEM 'b'>") - 1;
77827792
const XmlBigCount countBytesOutput
77837793
= rootParser->m_accounting.countBytesDirect
77847794
+ rootParser->m_accounting.countBytesIndirect;
77857795
const float amplificationFactor
77867796
= rootParser->m_accounting.countBytesDirect
77877797
? (countBytesOutput
77887798
/ (float)(rootParser->m_accounting.countBytesDirect))
7789-
: 1.0f;
7799+
: ((lenOfShortestInclude
7800+
+ rootParser->m_accounting.countBytesIndirect)
7801+
/ (float)lenOfShortestInclude);
77907802
assert(! rootParser->m_parentParser);
77917803
return amplificationFactor;
77927804
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.