From fc06a529a3283c9b0ec5e253e98f4c23d3b9caa8 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Tue, 6 Jun 2017 17:54:32 +0100 Subject: [PATCH] Reject multi-byte encodings with no converter function. Not supplying a character encoding convert function when one was needed previously caused a segfault if a multi-byte character was encountered. This errors at the start of parse instead. --- expat/lib/xmltok.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c index ebcc05b9..07b5d8fc 100644 --- a/expat/lib/xmltok.c +++ b/expat/lib/xmltok.c @@ -1469,6 +1469,9 @@ XmlInitUnknownEncoding(void *mem, else if (c < 0) { if (c < -4) return 0; + /* Multi-byte sequences need a converter function */ + if (!convert) + return 0; e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); e->utf8[i][0] = 0; e->utf16[i] = 0;