From 9ef50bf9cf93c3ea6747ec4154b36dd0de6a420f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 16 May 2023 06:19:05 +0000 Subject: [PATCH] import mingw-expat-2.4.8-2.el8 --- ...re-safe-exiting-internalEntityParser.patch | 122 ++++++++++++++++++ SPECS/mingw-expat.spec | 9 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 SOURCES/expat-2.4.8-Ensure-raw-tagnames-are-safe-exiting-internalEntityParser.patch diff --git a/SOURCES/expat-2.4.8-Ensure-raw-tagnames-are-safe-exiting-internalEntityParser.patch b/SOURCES/expat-2.4.8-Ensure-raw-tagnames-are-safe-exiting-internalEntityParser.patch new file mode 100644 index 0000000..d629dcd --- /dev/null +++ b/SOURCES/expat-2.4.8-Ensure-raw-tagnames-are-safe-exiting-internalEntityParser.patch @@ -0,0 +1,122 @@ +commit bfecc1f11ab5f0cc2aa3dc5cb87d3236a87ce61d +Author: Tomas Korbar +Date: Fri Sep 30 10:52:04 2022 +0200 + + Fix CVE-2022-40674 + +diff --git a/lib/xmlparse.c b/lib/xmlparse.c +index e986156..1352a89 100644 +--- a/lib/xmlparse.c ++++ b/lib/xmlparse.c +@@ -5826,10 +5826,15 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end, + { + parser->m_processor = contentProcessor; + /* see externalEntityContentProcessor vs contentProcessor */ +- return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding, +- s, end, nextPtr, +- (XML_Bool)! parser->m_parsingStatus.finalBuffer, +- XML_ACCOUNT_DIRECT); ++ result = doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding, ++ s, end, nextPtr, ++ (XML_Bool)! parser->m_parsingStatus.finalBuffer, ++ XML_ACCOUNT_DIRECT); ++ if (result == XML_ERROR_NONE) { ++ if (! storeRawNames(parser)) ++ return XML_ERROR_NO_MEMORY; ++ } ++ return result; + } + } + +diff --git a/tests/runtests.c b/tests/runtests.c +index ea371b4..193e103 100644 +--- a/tests/runtests.c ++++ b/tests/runtests.c +@@ -5008,6 +5008,78 @@ START_TEST(test_resume_entity_with_syntax_error) { + } + END_TEST + ++void ++suspending_comment_handler(void *userData, const XML_Char *UNUSED_P(data)) { ++ XML_Parser parser = (XML_Parser)userData; ++ XML_StopParser(parser, XML_TRUE); ++} ++ ++START_TEST(test_suspend_resume_internal_entity_issue_629) { ++ const char *const text ++ = "a'>]>&e;\n" ++ "<" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ++ "/>" ++ ""; ++ const size_t firstChunkSizeBytes = 54; ++ ++ XML_Parser parser = XML_ParserCreate(NULL); ++ XML_SetUserData(parser, parser); ++ XML_SetCommentHandler(parser, suspending_comment_handler); ++ ++ if (XML_Parse(parser, text, (int)firstChunkSizeBytes, XML_FALSE) ++ != XML_STATUS_SUSPENDED) ++ xml_failure(parser); ++ if (XML_ResumeParser(parser) != XML_STATUS_OK) ++ xml_failure(parser); ++ if (XML_Parse(parser, text + firstChunkSizeBytes, ++ (int)(strlen(text) - firstChunkSizeBytes), XML_TRUE) ++ != XML_STATUS_OK) ++ xml_failure(parser); ++ XML_ParserFree(parser); ++} ++END_TEST ++ ++ + /* Test suspending and resuming in a parameter entity substitution */ + static void XMLCALL + element_decl_suspender(void *userData, const XML_Char *name, +@@ -12017,6 +12089,7 @@ make_suite(void) { + tcase_add_test(tc_basic, test_hash_collision); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_suspend_resume_internal_entity); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_resume_entity_with_syntax_error); ++ tcase_add_test__ifdef_xml_dtd(tc_basic, test_suspend_resume_internal_entity_issue_629); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_suspend_resume_parameter_entity); + tcase_add_test(tc_basic, test_restart_on_error); + tcase_add_test(tc_basic, test_reject_lt_in_attribute_value); + diff --git a/SPECS/mingw-expat.spec b/SPECS/mingw-expat.spec index d58d277..be97d86 100644 --- a/SPECS/mingw-expat.spec +++ b/SPECS/mingw-expat.spec @@ -2,13 +2,15 @@ Name: mingw-expat Version: 2.4.8 -Release: 1%{?dist} +Release: 2%{?dist} Summary: MinGW Windows port of expat XML parser library License: MIT URL: http://www.libexpat.org/ Source0: http://downloads.sourceforge.net/expat/expat-%{version}.tar.bz2 +Patch0001: expat-2.4.8-Ensure-raw-tagnames-are-safe-exiting-internalEntityParser.patch + BuildArch: noarch ExclusiveArch: %{ix86} x86_64 @@ -74,6 +76,7 @@ Static version of the MinGW Windows expat XML parser library. %prep %setup -q -n expat-%{version} +%patch0001 -p1 -b .CVE-2022-40674 %build @@ -125,6 +128,10 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_mandir}/man1 %changelog +* Wed Jan 04 2023 Uri Lublin - 2.4.8-2 +- Fix CVE-2022-40674 + Resolves: rhbz#2130833 + * Mon May 02 2022 Uri Lublin - 2.4.8-1 - Update to 2.4.8 and pick up CVEs fixes - Resolves: rhbz#2050504 CVE-2022-23990