[libxml2] Stop parser on unsupported encodings
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Stop parser on unsupported encodings
- Date: Wed, 7 Jun 2017 18:07:11 +0000 (UTC)
commit 0db8dc9ddcc0b5fb435b869668fb2155d491e245
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Wed Jun 7 16:07:33 2017 +0200
Stop parser on unsupported encodings
Otherwise, the push parser can loop infinitely in recover mode.
Found with libFuzzer.
parserInternals.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/parserInternals.c b/parserInternals.c
index bfc778a..b867cbc 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1101,8 +1101,10 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
break;
}
}
- if (handler == NULL)
+ if (handler == NULL) {
+ xmlStopParser(ctxt);
return(-1);
+ }
ctxt->charset = XML_CHAR_ENCODING_UTF8;
ret = xmlSwitchToEncodingInt(ctxt, handler, len);
if ((ret < 0) || (ctxt->errNo == XML_I18N_CONV_FAILED)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]