Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commita99632f

Browse files
[3.10]gh-138998: Upgrade vendored expat to 2.7.2 (#138999) (#139053)
gh-138998: Upgrade vendored expat to 2.7.2 (#138999)(cherry picked from commit64c876d)
1 parent5c19c5b commita99632f

File tree

9 files changed

+750
-374
lines changed

9 files changed

+750
-374
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update bundled libexpat to 2.7.2

‎Modules/expat/expat.h‎

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@
4242
*/
4343

4444
#ifndef Expat_INCLUDED
45-
#defineExpat_INCLUDED1
45+
#defineExpat_INCLUDED1
4646

47-
#include<stdlib.h>
48-
#include"expat_external.h"
47+
#include<stdlib.h>
48+
#include"expat_external.h"
4949

50-
#ifdef __cplusplus
50+
#ifdef __cplusplus
5151
extern"C" {
52-
#endif
52+
#endif
5353

5454
structXML_ParserStruct;
5555
typedefstructXML_ParserStruct *XML_Parser;
5656

5757
typedefunsignedchar XML_Bool;
58-
#defineXML_TRUE ((XML_Bool)1)
59-
#defineXML_FALSE ((XML_Bool)0)
58+
#defineXML_TRUE ((XML_Bool)1)
59+
#defineXML_FALSE ((XML_Bool)0)
6060

6161
/* The XML_Status enum gives the possible return values for several
6262
API functions. The preprocessor #defines are included so this
@@ -73,11 +73,11 @@ typedef unsigned char XML_Bool;
7373
*/
7474
enum XML_Status {
7575
XML_STATUS_ERROR =0,
76-
#defineXML_STATUS_ERROR XML_STATUS_ERROR
76+
#defineXML_STATUS_ERROR XML_STATUS_ERROR
7777
XML_STATUS_OK =1,
78-
#defineXML_STATUS_OK XML_STATUS_OK
78+
#defineXML_STATUS_OK XML_STATUS_OK
7979
XML_STATUS_SUSPENDED =2
80-
#defineXML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
80+
#defineXML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
8181
};
8282

8383
enum XML_Error {
@@ -680,7 +680,7 @@ XMLPARSEAPI(void)
680680
XML_SetUserData(XML_Parser parser,void *userData);
681681

682682
/* Returns the last value set by XML_SetUserData or NULL.*/
683-
#defineXML_GetUserData(parser) (*(void **)(parser))
683+
#defineXML_GetUserData(parser) (*(void **)(parser))
684684

685685
/* This is equivalent to supplying an encoding argument to
686686
XML_ParserCreate. On success XML_SetEncoding returns non-zero,
@@ -752,7 +752,7 @@ XML_GetSpecifiedAttributeCount(XML_Parser parser);
752752
XMLPARSEAPI(int)
753753
XML_GetIdAttributeIndex(XML_Parser parser);
754754

755-
#ifdef XML_ATTR_INFO
755+
#ifdef XML_ATTR_INFO
756756
/* Source file byte offsets for the start and end of attribute names and values.
757757
The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
758758
file an attribute value of "blah" will yield:
@@ -773,7 +773,7 @@ typedef struct {
773773
*/
774774
XMLPARSEAPI(const XML_AttrInfo *)
775775
XML_GetAttributeInfo(XML_Parser parser);
776-
#endif
776+
#endif
777777

778778
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
779779
detected. The last call to XML_Parse must have isFinal true; len
@@ -970,9 +970,9 @@ XMLPARSEAPI(const char *)
970970
XML_GetInputContext(XML_Parser parser,int *offset,int *size);
971971

972972
/* For backwards compatibility with previous versions.*/
973-
#defineXML_GetErrorLineNumber XML_GetCurrentLineNumber
974-
#defineXML_GetErrorColumnNumber XML_GetCurrentColumnNumber
975-
#defineXML_GetErrorByteIndex XML_GetCurrentByteIndex
973+
#defineXML_GetErrorLineNumber XML_GetCurrentLineNumber
974+
#defineXML_GetErrorColumnNumber XML_GetCurrentColumnNumber
975+
#defineXML_GetErrorByteIndex XML_GetCurrentByteIndex
976976

977977
/* Frees the content model passed to the element declaration handler*/
978978
XMLPARSEAPI(void)
@@ -1032,7 +1032,10 @@ enum XML_FeatureEnum {
10321032
XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
10331033
XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT,
10341034
/* Added in Expat 2.6.0.*/
1035-
XML_FEATURE_GE
1035+
XML_FEATURE_GE,
1036+
/* Added in Expat 2.7.2.*/
1037+
XML_FEATURE_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT,
1038+
XML_FEATURE_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT,
10361039
/* Additional features must be added to the end of this enum.*/
10371040
};
10381041

@@ -1045,7 +1048,7 @@ typedef struct {
10451048
XMLPARSEAPI(const XML_Feature *)
10461049
XML_GetFeatureList(void);
10471050

1048-
#if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
1051+
#if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
10491052
/* Added in Expat 2.4.0 for XML_DTD defined and
10501053
* added in Expat 2.6.0 for XML_GE == 1.*/
10511054
XMLPARSEAPI(XML_Bool)
@@ -1057,7 +1060,17 @@ XML_SetBillionLaughsAttackProtectionMaximumAmplification(
10571060
XMLPARSEAPI(XML_Bool)
10581061
XML_SetBillionLaughsAttackProtectionActivationThreshold(
10591062
XML_Parser parser,unsignedlonglong activationThresholdBytes);
1060-
#endif
1063+
1064+
/* Added in Expat 2.7.2.*/
1065+
XMLPARSEAPI(XML_Bool)
1066+
XML_SetAllocTrackerMaximumAmplification(XML_Parser parser,
1067+
float maximumAmplificationFactor);
1068+
1069+
/* Added in Expat 2.7.2.*/
1070+
XMLPARSEAPI(XML_Bool)
1071+
XML_SetAllocTrackerActivationThreshold(
1072+
XML_Parser parser,unsignedlonglong activationThresholdBytes);
1073+
#endif
10611074

10621075
/* Added in Expat 2.6.0.*/
10631076
XMLPARSEAPI(XML_Bool)
@@ -1066,12 +1079,12 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
10661079
/* Expat follows the semantic versioning convention.
10671080
See https://semver.org
10681081
*/
1069-
#defineXML_MAJOR_VERSION2
1070-
#defineXML_MINOR_VERSION7
1071-
#defineXML_MICRO_VERSION1
1082+
#defineXML_MAJOR_VERSION2
1083+
#defineXML_MINOR_VERSION7
1084+
#defineXML_MICRO_VERSION2
10721085

1073-
#ifdef __cplusplus
1086+
#ifdef __cplusplus
10741087
}
1075-
#endif
1088+
#endif
10761089

10771090
#endif/* not Expat_INCLUDED*/

‎Modules/expat/expat_external.h‎

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
*/
3939

4040
#ifndef Expat_External_INCLUDED
41-
#defineExpat_External_INCLUDED1
42-
41+
#defineExpat_External_INCLUDED1
4342
/* Namespace external symbols to allow multiple libexpat version to
4443
co-exist.*/
4544
#include"pyexpatns.h"
@@ -68,12 +67,12 @@
6867
compiled with the cdecl calling convention as the default since
6968
system headers may assume the cdecl convention.
7069
*/
71-
#ifndef XMLCALL
72-
#if defined(_MSC_VER)
73-
#defineXMLCALL __cdecl
74-
#elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
75-
#defineXMLCALL__attribute__((cdecl))
76-
#else
70+
#ifndef XMLCALL
71+
#if defined(_MSC_VER)
72+
#defineXMLCALL __cdecl
73+
#elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
74+
#defineXMLCALL__attribute__((cdecl))
75+
#else
7776
/* For any platform which uses this definition and supports more than
7877
one calling convention, we need to extend this definition to
7978
declare the convention used on that platform, if it's possible to
@@ -84,86 +83,87 @@
8483
pre-processor and how to specify the same calling convention as the
8584
platform's malloc() implementation.
8685
*/
87-
#defineXMLCALL
88-
#endif
89-
#endif/* not defined XMLCALL*/
86+
#defineXMLCALL
87+
#endif
88+
#endif/* not defined XMLCALL*/
9089

91-
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
92-
#ifndef XML_BUILDING_EXPAT
90+
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
91+
#ifndef XML_BUILDING_EXPAT
9392
/* using Expat from an application*/
9493

95-
#if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
96-
#defineXMLIMPORT__declspec(dllimport)
94+
#if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) \
95+
&& !defined(__CYGWIN__)
96+
#defineXMLIMPORT__declspec(dllimport)
97+
# endif
98+
9799
#endif
100+
#endif/* not defined XML_STATIC*/
98101

102+
#ifndef XML_ENABLE_VISIBILITY
103+
#defineXML_ENABLE_VISIBILITY0
99104
#endif
100-
#endif/* not defined XML_STATIC*/
101-
102-
#ifndef XML_ENABLE_VISIBILITY
103-
#defineXML_ENABLE_VISIBILITY0
104-
#endif
105105

106-
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
107-
#defineXMLIMPORT__attribute__((visibility("default")))
108-
#endif
106+
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
107+
#defineXMLIMPORT__attribute__((visibility("default")))
108+
#endif
109109

110110
/* If we didn't define it above, define it away:*/
111-
#ifndef XMLIMPORT
112-
#defineXMLIMPORT
113-
#endif
114-
115-
#if defined(__GNUC__) \
116-
&& (__GNUC__ >2 || (__GNUC__ ==2 && __GNUC_MINOR__ >=96))
117-
#defineXML_ATTR_MALLOC__attribute__((__malloc__))
118-
#else
119-
#defineXML_ATTR_MALLOC
120-
#endif
121-
122-
#if defined(__GNUC__) \
123-
&& ((__GNUC__ >4) || (__GNUC__ ==4 && __GNUC_MINOR__ >=3))
124-
#defineXML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
125-
#else
126-
#defineXML_ATTR_ALLOC_SIZE(x)
127-
#endif
128-
129-
#defineXMLPARSEAPI(type) XMLIMPORT type XMLCALL
130-
131-
#ifdef __cplusplus
132-
extern"C" {
133-
#endif
111+
#ifndef XMLIMPORT
112+
#defineXMLIMPORT
113+
#endif
134114

135-
#ifdef XML_UNICODE_WCHAR_T
136-
#ifndef XML_UNICODE
137-
#defineXML_UNICODE
115+
#if defined(__GNUC__) \
116+
&& (__GNUC__ >2 || (__GNUC__ ==2 && __GNUC_MINOR__ >=96))
117+
#defineXML_ATTR_MALLOC__attribute__((__malloc__))
118+
#else
119+
#defineXML_ATTR_MALLOC
138120
#endif
139-
#if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
140-
#error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
121+
122+
#if defined(__GNUC__) \
123+
&& ((__GNUC__ >4) || (__GNUC__ ==4 && __GNUC_MINOR__ >=3))
124+
#defineXML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
125+
#else
126+
#defineXML_ATTR_ALLOC_SIZE(x)
127+
#endif
128+
129+
#defineXMLPARSEAPI(type) XMLIMPORT type XMLCALL
130+
131+
#ifdef __cplusplus
132+
extern"C" {
141133
# endif
142-
#endif
143134

144-
#ifdef XML_UNICODE/* Information is UTF-16 encoded.*/
145135
#ifdef XML_UNICODE_WCHAR_T
136+
#ifndef XML_UNICODE
137+
#defineXML_UNICODE
138+
#endif
139+
#if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
140+
#error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
141+
#endif
142+
#endif
143+
144+
#ifdef XML_UNICODE/* Information is UTF-16 encoded.*/
145+
#ifdef XML_UNICODE_WCHAR_T
146146
typedefwchar_t XML_Char;
147147
typedefwchar_t XML_LChar;
148-
#else
148+
#else
149149
typedefunsignedshort XML_Char;
150150
typedefchar XML_LChar;
151-
#endif/* XML_UNICODE_WCHAR_T*/
152-
#else/* Information is UTF-8 encoded.*/
151+
#endif/* XML_UNICODE_WCHAR_T*/
152+
#else/* Information is UTF-8 encoded.*/
153153
typedefchar XML_Char;
154154
typedefchar XML_LChar;
155-
#endif/* XML_UNICODE*/
155+
#endif/* XML_UNICODE*/
156156

157-
#ifdef XML_LARGE_SIZE/* Use large integers for file/stream positions.*/
157+
#ifdef XML_LARGE_SIZE/* Use large integers for file/stream positions.*/
158158
typedeflonglong XML_Index;
159159
typedefunsignedlonglong XML_Size;
160-
#else
160+
#else
161161
typedeflong XML_Index;
162162
typedefunsignedlong XML_Size;
163-
#endif/* XML_LARGE_SIZE*/
163+
#endif/* XML_LARGE_SIZE*/
164164

165-
#ifdef __cplusplus
165+
#ifdef __cplusplus
166166
}
167-
#endif
167+
#endif
168168

169169
#endif/* not Expat_External_INCLUDED*/

‎Modules/expat/internal.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
100.0f
149149
#defineEXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT \
150150
8388608 // 8 MiB, 2^23
151+
152+
#defineEXPAT_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT 100.0f
153+
#defineEXPAT_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT \
154+
67108864 // 64 MiB, 2^26
155+
151156
/* NOTE END */
152157

153158
#include"expat.h"// so we can use type XML_Parser below
@@ -171,6 +176,9 @@ extern
171176
#endif
172177
XML_Boolg_reparseDeferralEnabledDefault;// written ONLY in runtests.c
173178
#if defined(XML_TESTING)
179+
void*expat_malloc(XML_Parserparser,size_tsize,intsourceLine);
180+
voidexpat_free(XML_Parserparser,void*ptr,intsourceLine);
181+
void*expat_realloc(XML_Parserparser,void*ptr,size_tsize,intsourceLine);
174182
externunsignedintg_bytesScanned;// used for testing only
175183
#endif
176184

‎Modules/expat/refresh.sh‎

Lines changed: 4 additions & 4 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_1"
16-
expected_libexpat_version="2.7.1"
17-
expected_libexpat_sha256="0cce2e6e69b327fc607b8ff264f4b66bdf71ead55a87ffd5f3143f535f15cfa2"
15+
expected_libexpat_tag="R_2_7_2"
16+
expected_libexpat_version="2.7.2"
17+
expected_libexpat_sha256="13d42a125897329bfeecab899cb9b5a3ec8c26072994b5cd4c41f28241f5bce7"
1818

1919
expat_dir="$(realpath"$(dirname --"${BASH_SOURCE[0]}")")"
2020
cd${expat_dir}
@@ -52,6 +52,6 @@ done
5252
rm libexpat.tar.gz
5353

5454
# Step 3: Add the namespacing include to expat_external.h
55-
sed -i's/#define Expat_External_INCLUDED 1/&\n\n\/* Namespace external symbols to allow multiple libexpat version to\n co-exist. \*\/\n#include "pyexpatns.h"/' expat_external.h
55+
sed -i's/#define Expat_External_INCLUDED 1/&\n\/* Namespace external symbols to allow multiple libexpat version to\n co-exist. \*\/\n#include "pyexpatns.h"/' expat_external.h
5656

5757
echo"Updated; verify all is okay using git diff and git status."

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp