153aa9179Sopenharmony_ciFrom 800bb118a5cb30232a295b89df8cb749eece49af Mon Sep 17 00:00:00 2001 253aa9179Sopenharmony_ciFrom: Nick Wellnhofer <wellnhofer@aevum.de> 353aa9179Sopenharmony_ciDate: Mon, 14 Nov 2022 22:00:50 +0100 453aa9179Sopenharmony_ciSubject: [PATCH 16/28] reader: Switch to xmlParserInputBufferCreateMem 553aa9179Sopenharmony_ci 653aa9179Sopenharmony_ciThis is less efficient but can't result in input buffer overreads. 753aa9179Sopenharmony_ci 853aa9179Sopenharmony_ciFixes #326. 953aa9179Sopenharmony_ci 1053aa9179Sopenharmony_ciReference: https://github.com/GNOME/libxml2/commit/1ca0dfec351a089537127911607c5e89bc937840 1153aa9179Sopenharmony_ciConflict: NA 1253aa9179Sopenharmony_ci--- 1353aa9179Sopenharmony_ci xmlreader.c | 5 ++--- 1453aa9179Sopenharmony_ci 1 file changed, 2 insertions(+), 3 deletions(-) 1553aa9179Sopenharmony_ci 1653aa9179Sopenharmony_cidiff --git a/xmlreader.c b/xmlreader.c 1753aa9179Sopenharmony_ciindex 989b7c1..ac97bde 100644 1853aa9179Sopenharmony_ci--- a/xmlreader.c 1953aa9179Sopenharmony_ci+++ b/xmlreader.c 2053aa9179Sopenharmony_ci@@ -5508,8 +5508,7 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL, 2153aa9179Sopenharmony_ci xmlTextReaderPtr reader; 2253aa9179Sopenharmony_ci xmlParserInputBufferPtr buf; 2353aa9179Sopenharmony_ci 2453aa9179Sopenharmony_ci- buf = xmlParserInputBufferCreateStatic(buffer, size, 2553aa9179Sopenharmony_ci- XML_CHAR_ENCODING_NONE); 2653aa9179Sopenharmony_ci+ buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE); 2753aa9179Sopenharmony_ci if (buf == NULL) { 2853aa9179Sopenharmony_ci return (NULL); 2953aa9179Sopenharmony_ci } 3053aa9179Sopenharmony_ci@@ -5735,7 +5734,7 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size, 3153aa9179Sopenharmony_ci if (buffer == NULL) 3253aa9179Sopenharmony_ci return (-1); 3353aa9179Sopenharmony_ci 3453aa9179Sopenharmony_ci- input = xmlParserInputBufferCreateStatic(buffer, size, 3553aa9179Sopenharmony_ci+ input = xmlParserInputBufferCreateMem(buffer, size, 3653aa9179Sopenharmony_ci XML_CHAR_ENCODING_NONE); 3753aa9179Sopenharmony_ci if (input == NULL) { 3853aa9179Sopenharmony_ci return (-1); 3953aa9179Sopenharmony_ci-- 4053aa9179Sopenharmony_ci2.27.0 4153aa9179Sopenharmony_ci 42