summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-05-25 12:25:48 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-05-25 12:25:48 (GMT)
commit6dc32b34ddfba0ddb990cbbb77cf8803879d20f9 (patch)
tree52b3529adfb9b0ccdf71bd5a34a1edb8bb50fdff /Include
parent6b5a38c728bbca3273b6917308559cf22e298531 (diff)
downloadcpython-6dc32b34ddfba0ddb990cbbb77cf8803879d20f9.zip
cpython-6dc32b34ddfba0ddb990cbbb77cf8803879d20f9.tar.gz
cpython-6dc32b34ddfba0ddb990cbbb77cf8803879d20f9.tar.bz2
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 8a79974..44259bf 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! */
};