Skip to content

Commit

Permalink
gh-97005: Update libexpat from 2.4.7 to 2.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Sep 22, 2022
1 parent b4f5f07 commit cd6321b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update bundled libexpat to 2.4.9
2 changes: 1 addition & 1 deletion Modules/expat/expat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ XML_SetBillionLaughsAttackProtectionActivationThreshold(
*/
#define XML_MAJOR_VERSION 2
#define XML_MINOR_VERSION 4
#define XML_MICRO_VERSION 7
#define XML_MICRO_VERSION 8

#ifdef __cplusplus
}
Expand Down
19 changes: 12 additions & 7 deletions Modules/expat/xmlparse.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* fcb1a62fefa945567301146eb98e3ad3413e823a41c4378e84e8b6b6f308d824 (2.4.7+)
/* 90815a2b2c80c03b2b889fe1d427bb2b9e3282aa065e42784e001db4f23de324 (2.4.9+)
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
Expand All @@ -19,7 +19,7 @@
Copyright (c) 2016 Gustavo Grieco <[email protected]>
Copyright (c) 2016 Pascal Cuoq <[email protected]>
Copyright (c) 2016 Ed Schouten <[email protected]>
Copyright (c) 2017-2018 Rhodri James <[email protected]>
Copyright (c) 2017-2022 Rhodri James <[email protected]>
Copyright (c) 2017 Václav Slavík <[email protected]>
Copyright (c) 2017 Viktor Szakats <[email protected]>
Copyright (c) 2017 Chanho Park <[email protected]>
Expand Down Expand Up @@ -4271,7 +4271,7 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s,
const XML_Char *storedEncName = NULL;
const ENCODING *newEncoding = NULL;
const char *version = NULL;
const char *versionend;
const char *versionend = NULL;
const XML_Char *storedversion = NULL;
int standalone = -1;

Expand Down Expand Up @@ -5826,10 +5826,15 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end,
{
parser->m_processor = contentProcessor;
/* see externalEntityContentProcessor vs contentProcessor */
return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding,
s, end, nextPtr,
(XML_Bool)! parser->m_parsingStatus.finalBuffer,
XML_ACCOUNT_DIRECT);
result = doContent(parser, parser->m_parentParser ? 1 : 0,
parser->m_encoding, s, end, nextPtr,
(XML_Bool)! parser->m_parsingStatus.finalBuffer,
XML_ACCOUNT_DIRECT);
if (result == XML_ERROR_NONE) {
if (! storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
}
return result;
}
}

Expand Down
7 changes: 4 additions & 3 deletions Modules/expat/xmltok.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Copyright (c) 2017 José Gutiérrez de la Concha <[email protected]>
Copyright (c) 2019 David Loffredo <[email protected]>
Copyright (c) 2021 Dong-hee Na <[email protected]>
Copyright (c) 2022 Martin Ettl <[email protected]>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -296,7 +297,7 @@ sb_charMatches(const ENCODING *enc, const char *p, int c) {
}
#else
/* c is an ASCII character */
# define CHAR_MATCHES(enc, p, c) (*(p) == c)
# define CHAR_MATCHES(enc, p, c) (*(p) == (c))
#endif

#define PREFIX(ident) normal_##ident
Expand Down Expand Up @@ -740,7 +741,7 @@ DEFINE_UTF16_TO_UTF16(big2_)
((p)[1] == 0 ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
: unicode_byte_type((p)[1], (p)[0]))
#define LITTLE2_BYTE_TO_ASCII(p) ((p)[1] == 0 ? (p)[0] : -1)
#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == c)
#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == (c))
#define LITTLE2_IS_NAME_CHAR_MINBPC(p) \
UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p) \
Expand Down Expand Up @@ -875,7 +876,7 @@ static const struct normal_encoding internal_little2_encoding
? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
: unicode_byte_type((p)[0], (p)[1]))
#define BIG2_BYTE_TO_ASCII(p) ((p)[0] == 0 ? (p)[1] : -1)
#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == c)
#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == (c))
#define BIG2_IS_NAME_CHAR_MINBPC(p) \
UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
#define BIG2_IS_NMSTRT_CHAR_MINBPC(p) \
Expand Down
6 changes: 4 additions & 2 deletions Modules/expat/xmltok_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Copyright (c) 2018 Anton Maklakov <[email protected]>
Copyright (c) 2019 David Loffredo <[email protected]>
Copyright (c) 2020 Boris Kolpackov <[email protected]>
Copyright (c) 2022 Martin Ettl <[email protected]>
Licensed under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -96,7 +97,7 @@

# define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \
case BT_LEAD##n: \
if (end - ptr < n) \
if ((end) - (ptr) < (n)) \
return XML_TOK_PARTIAL_CHAR; \
if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NMSTRT_CHAR(enc, ptr, n)) { \
*nextTokPtr = ptr; \
Expand Down Expand Up @@ -124,7 +125,8 @@
# define PREFIX(ident) ident
# endif

# define HAS_CHARS(enc, ptr, end, count) (end - ptr >= count * MINBPC(enc))
# define HAS_CHARS(enc, ptr, end, count) \
((end) - (ptr) >= ((count)*MINBPC(enc)))

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

Expand Down

0 comments on commit cd6321b

Please sign in to comment.