mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13612: handle unknown encodings without a buffer overflow.
This affects pyexpat and _elementtree. PyExpat_CAPI now exposes a new function - DefaultUnknownEncodingHandler. Based on a patch by Serhiy Storchaka.
This commit is contained in:
parent
6b5a38c728
commit
6dc32b34dd
4 changed files with 128 additions and 79 deletions
|
@ -6,7 +6,7 @@
|
|||
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
|
||||
#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
|
||||
|
||||
struct PyExpat_CAPI
|
||||
struct PyExpat_CAPI
|
||||
{
|
||||
char* magic; /* set to PyExpat_CAPI_MAGIC */
|
||||
int size; /* set to sizeof(struct PyExpat_CAPI) */
|
||||
|
@ -46,6 +46,8 @@ struct PyExpat_CAPI
|
|||
void (*SetStartDoctypeDeclHandler)(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start);
|
||||
enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
|
||||
int (*DefaultUnknownEncodingHandler)(
|
||||
void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
|
||||
/* always add new stuff to the end! */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue