summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-05-25 05:25:48 -0700
committerEli Bendersky <eliben@gmail.com>2013-05-25 05:25:48 -0700
commite48b606a8a24941cdf36eddc42f49bc83d277728 (patch)
tree897e533d32f404736b8bbfd75719550d3a588d7a /Include
parent4e34e5b9557b9ba5789a9465bbf1ed6bb1a9069c (diff)
downloadcpython-e48b606a8a24941cdf36eddc42f49bc83d277728.tar.gz
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/pyexpat.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/pyexpat.h b/Include/pyexpat.h
index 8a799746b3..44259bf6d7 100644
--- a/Include/pyexpat.h
+++ b/Include/pyexpat.h
@@ -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! */
};