Skip to content

Commit 0e4571a

Browse files
authored
bpo-29591: Upgrade Modules/expat to libexpat 2.2 (#2164) (#2202)
* bpo-29591: Upgrade Modules/expat to libexpat 2.2 * bpo-29591: Restore Python changes on expat * bpo-29591: Remove expat config of unsupported platforms Remove the configuration (Modules/expat/*config.h) of unsupported platforms: * Amiga * MacOS Classic on PPC32 * Open Watcom * bpo-29591: Remove useless XML_HAS_SET_HASH_SALT The XML_HAS_SET_HASH_SALT define of Modules/expat/expat.h became useless since our local expat copy was upgrade to expat 2.1 (it's now expat 2.2.0). (cherry picked from commit 23ec4b5)
1 parent 4b30107 commit 0e4571a

File tree

14 files changed

+527
-477
lines changed

14 files changed

+527
-477
lines changed

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Extension Modules
4949
Library
5050
-------
5151

52+
- [Security] bpo-29591: Update expat copy from 2.1.1 to 2.2.0 to get fixes
53+
of CVE-2016-0718 and CVE-2016-4472. See
54+
https://sourceforge.net/p/expat/bugs/537/ for more information.
55+
5256
- bpo-28994: The traceback no longer displayed for SystemExit raised in
5357
a callback registered by atexit.
5458

Modules/expat/COPYING

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
2-
and Clark Cooper
3-
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
1+
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
2+
Copyright (c) 2001-2016 Expat maintainers
43

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

Modules/expat/amigaconfig.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

Modules/expat/expat.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ XML_SetEntityDeclHandler(XML_Parser parser,
342342
XML_EntityDeclHandler handler);
343343

344344
/* OBSOLETE -- OBSOLETE -- OBSOLETE
345-
This handler has been superceded by the EntityDeclHandler above.
345+
This handler has been superseded by the EntityDeclHandler above.
346346
It is provided here for backward compatibility.
347347
348348
This is called for a declaration of an unparsed (NDATA) entity.
@@ -915,8 +915,6 @@ XMLPARSEAPI(int)
915915
XML_SetHashSalt(XML_Parser parser,
916916
unsigned long hash_salt);
917917

918-
#define XML_HAS_SET_HASH_SALT /* Python Only: Defined for pyexpat.c. */
919-
920918
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
921919
XML_GetErrorCode returns information about the error.
922920
*/
@@ -975,9 +973,12 @@ XML_FreeContentModel(XML_Parser parser, XML_Content *model);
975973

976974
/* Exposing the memory handling functions used in Expat */
977975
XMLPARSEAPI(void *)
976+
XML_ATTR_MALLOC
977+
XML_ATTR_ALLOC_SIZE(2)
978978
XML_MemMalloc(XML_Parser parser, size_t size);
979979

980980
XMLPARSEAPI(void *)
981+
XML_ATTR_ALLOC_SIZE(3)
981982
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
982983

983984
XMLPARSEAPI(void)
@@ -1033,14 +1034,12 @@ XMLPARSEAPI(const XML_Feature *)
10331034
XML_GetFeatureList(void);
10341035

10351036

1036-
/* Expat follows the GNU/Linux convention of odd number minor version for
1037-
beta/development releases and even number minor version for stable
1038-
releases. Micro is bumped with each release, and set to 0 with each
1039-
change to major or minor version.
1037+
/* Expat follows the semantic versioning convention.
1038+
See http://semver.org.
10401039
*/
10411040
#define XML_MAJOR_VERSION 2
1042-
#define XML_MINOR_VERSION 1
1043-
#define XML_MICRO_VERSION 1
1041+
#define XML_MINOR_VERSION 2
1042+
#define XML_MICRO_VERSION 0
10441043

10451044
#ifdef __cplusplus
10461045
}

Modules/expat/expat_external.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,26 @@
6969
#endif
7070
#endif /* not defined XML_STATIC */
7171

72+
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
73+
#define XMLIMPORT __attribute__ ((visibility ("default")))
74+
#endif
7275

7376
/* If we didn't define it above, define it away: */
7477
#ifndef XMLIMPORT
7578
#define XMLIMPORT
7679
#endif
7780

81+
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
82+
#define XML_ATTR_MALLOC __attribute__((__malloc__))
83+
#else
84+
#define XML_ATTR_MALLOC
85+
#endif
86+
87+
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
88+
#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
89+
#else
90+
#define XML_ATTR_ALLOC_SIZE(x)
91+
#endif
7892

7993
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
8094

Modules/expat/internal.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,25 @@
7171
#define inline
7272
#endif
7373
#endif
74+
75+
#ifndef UNUSED_P
76+
# ifdef __GNUC__
77+
# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
78+
# else
79+
# define UNUSED_P(p) UNUSED_ ## p
80+
# endif
81+
#endif
82+
83+
84+
#ifdef __cplusplus
85+
extern "C" {
86+
#endif
87+
88+
89+
void
90+
align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef);
91+
92+
93+
#ifdef __cplusplus
94+
}
95+
#endif

Modules/expat/macconfig.h

Lines changed: 0 additions & 53 deletions
This file was deleted.

Modules/expat/watcomconfig.h

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)