Skip to content

Commit 6d9905f

Browse files
gh-97005: Update libexpat from 2.4.7 to 2.4.9 (gh-97006)
Co-authored-by: Gregory P. Smith [Google] <[email protected]> (cherry picked from commit 10e3d39) Co-authored-by: Dong-hee Na <[email protected]>
1 parent d35b9d0 commit 6d9905f

File tree

8 files changed

+28
-17
lines changed

8 files changed

+28
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update bundled libexpat to 2.4.9

Modules/expat/COPYING

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
2-
Copyright (c) 2001-2019 Expat maintainers
2+
Copyright (c) 2001-2022 Expat maintainers
33

44
Permission is hereby granted, free of charge, to any person obtaining
55
a copy of this software and associated documentation files (the

Modules/expat/expat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ XML_SetBillionLaughsAttackProtectionActivationThreshold(
10551055
*/
10561056
#define XML_MAJOR_VERSION 2
10571057
#define XML_MINOR_VERSION 4
1058-
#define XML_MICRO_VERSION 7
1058+
#define XML_MICRO_VERSION 9
10591059

10601060
#ifdef __cplusplus
10611061
}

Modules/expat/internal.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Copyright (c) 2002-2003 Fred L. Drake, Jr. <[email protected]>
2929
Copyright (c) 2002-2006 Karl Waclawek <[email protected]>
3030
Copyright (c) 2003 Greg Stein <[email protected]>
31-
Copyright (c) 2016-2021 Sebastian Pipping <[email protected]>
31+
Copyright (c) 2016-2022 Sebastian Pipping <[email protected]>
3232
Copyright (c) 2018 Yury Gribov <[email protected]>
3333
Copyright (c) 2019 David Loffredo <[email protected]>
3434
Licensed under the MIT license:
@@ -107,7 +107,9 @@
107107

108108
#include <limits.h> // ULONG_MAX
109109

110-
#if defined(_WIN32) && ! defined(__USE_MINGW_ANSI_STDIO)
110+
#if defined(_WIN32) \
111+
&& (! defined(__USE_MINGW_ANSI_STDIO) \
112+
|| (1 - __USE_MINGW_ANSI_STDIO - 1 == 0))
111113
# define EXPAT_FMT_ULL(midpart) "%" midpart "I64u"
112114
# if defined(_WIN64) // Note: modifiers "td" and "zu" do not work for MinGW
113115
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "I64d"

Modules/expat/siphash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
* if this code is included and compiled as C++; related GCC warning is:
107107
* warning: use of C++11 long long integer constant [-Wlong-long]
108108
*/
109-
#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low)
109+
#define _SIP_ULL(high, low) ((((uint64_t)high) << 32) | (low))
110110

111111
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
112112

Modules/expat/xmlparse.c

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* fcb1a62fefa945567301146eb98e3ad3413e823a41c4378e84e8b6b6f308d824 (2.4.7+)
1+
/* 90815a2b2c80c03b2b889fe1d427bb2b9e3282aa065e42784e001db4f23de324 (2.4.9+)
22
__ __ _
33
___\ \/ /_ __ __ _| |_
44
/ _ \\ /| '_ \ / _` | __|
@@ -19,7 +19,7 @@
1919
Copyright (c) 2016 Gustavo Grieco <[email protected]>
2020
Copyright (c) 2016 Pascal Cuoq <[email protected]>
2121
Copyright (c) 2016 Ed Schouten <[email protected]>
22-
Copyright (c) 2017-2018 Rhodri James <[email protected]>
22+
Copyright (c) 2017-2022 Rhodri James <[email protected]>
2323
Copyright (c) 2017 Václav Slavík <[email protected]>
2424
Copyright (c) 2017 Viktor Szakats <[email protected]>
2525
Copyright (c) 2017 Chanho Park <[email protected]>
@@ -4271,7 +4271,7 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s,
42714271
const XML_Char *storedEncName = NULL;
42724272
const ENCODING *newEncoding = NULL;
42734273
const char *version = NULL;
4274-
const char *versionend;
4274+
const char *versionend = NULL;
42754275
const XML_Char *storedversion = NULL;
42764276
int standalone = -1;
42774277

@@ -5826,10 +5826,15 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end,
58265826
{
58275827
parser->m_processor = contentProcessor;
58285828
/* see externalEntityContentProcessor vs contentProcessor */
5829-
return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding,
5830-
s, end, nextPtr,
5831-
(XML_Bool)! parser->m_parsingStatus.finalBuffer,
5832-
XML_ACCOUNT_DIRECT);
5829+
result = doContent(parser, parser->m_parentParser ? 1 : 0,
5830+
parser->m_encoding, s, end, nextPtr,
5831+
(XML_Bool)! parser->m_parsingStatus.finalBuffer,
5832+
XML_ACCOUNT_DIRECT);
5833+
if (result == XML_ERROR_NONE) {
5834+
if (! storeRawNames(parser))
5835+
return XML_ERROR_NO_MEMORY;
5836+
}
5837+
return result;
58335838
}
58345839
}
58355840

Modules/expat/xmltok.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2017 José Gutiérrez de la Concha <[email protected]>
2222
Copyright (c) 2019 David Loffredo <[email protected]>
2323
Copyright (c) 2021 Dong-hee Na <[email protected]>
24+
Copyright (c) 2022 Martin Ettl <[email protected]>
2425
Licensed under the MIT license:
2526
2627
Permission is hereby granted, free of charge, to any person obtaining
@@ -296,7 +297,7 @@ sb_charMatches(const ENCODING *enc, const char *p, int c) {
296297
}
297298
#else
298299
/* c is an ASCII character */
299-
# define CHAR_MATCHES(enc, p, c) (*(p) == c)
300+
# define CHAR_MATCHES(enc, p, c) (*(p) == (c))
300301
#endif
301302

302303
#define PREFIX(ident) normal_##ident
@@ -740,7 +741,7 @@ DEFINE_UTF16_TO_UTF16(big2_)
740741
((p)[1] == 0 ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
741742
: unicode_byte_type((p)[1], (p)[0]))
742743
#define LITTLE2_BYTE_TO_ASCII(p) ((p)[1] == 0 ? (p)[0] : -1)
743-
#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == c)
744+
#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == (c))
744745
#define LITTLE2_IS_NAME_CHAR_MINBPC(p) \
745746
UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
746747
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p) \
@@ -875,7 +876,7 @@ static const struct normal_encoding internal_little2_encoding
875876
? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
876877
: unicode_byte_type((p)[0], (p)[1]))
877878
#define BIG2_BYTE_TO_ASCII(p) ((p)[0] == 0 ? (p)[1] : -1)
878-
#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == c)
879+
#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == (c))
879880
#define BIG2_IS_NAME_CHAR_MINBPC(p) \
880881
UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
881882
#define BIG2_IS_NMSTRT_CHAR_MINBPC(p) \

Modules/expat/xmltok_impl.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Copyright (c) 2018 Anton Maklakov <[email protected]>
1717
Copyright (c) 2019 David Loffredo <[email protected]>
1818
Copyright (c) 2020 Boris Kolpackov <[email protected]>
19+
Copyright (c) 2022 Martin Ettl <[email protected]>
1920
Licensed under the MIT license:
2021
2122
Permission is hereby granted, free of charge, to any person obtaining
@@ -96,7 +97,7 @@
9697

9798
# define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \
9899
case BT_LEAD##n: \
99-
if (end - ptr < n) \
100+
if ((end) - (ptr) < (n)) \
100101
return XML_TOK_PARTIAL_CHAR; \
101102
if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NMSTRT_CHAR(enc, ptr, n)) { \
102103
*nextTokPtr = ptr; \
@@ -124,7 +125,8 @@
124125
# define PREFIX(ident) ident
125126
# endif
126127

127-
# define HAS_CHARS(enc, ptr, end, count) (end - ptr >= count * MINBPC(enc))
128+
# define HAS_CHARS(enc, ptr, end, count) \
129+
((end) - (ptr) >= ((count)*MINBPC(enc)))
128130

129131
# define HAS_CHAR(enc, ptr, end) HAS_CHARS(enc, ptr, end, 1)
130132

0 commit comments

Comments
 (0)