From 561746081f633245b326e31e6ef0f2ef20b48ef6 Mon Sep 17 00:00:00 2001 From: vincent-richard Date: Tue, 25 Jan 2022 10:28:20 +0100 Subject: Fixed possible recursion crash when parsing mailbox groups. --- tests/parser/mailboxListTest.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/parser/mailboxListTest.cpp') diff --git a/tests/parser/mailboxListTest.cpp b/tests/parser/mailboxListTest.cpp index 7505acd9..2036863d 100644 --- a/tests/parser/mailboxListTest.cpp +++ b/tests/parser/mailboxListTest.cpp @@ -28,6 +28,7 @@ VMIME_TEST_SUITE_BEGIN(mailboxListTest) VMIME_TEST_LIST_BEGIN VMIME_TEST(testParseGroup) + VMIME_TEST(testBrokenGroup) VMIME_TEST_LIST_END @@ -44,4 +45,18 @@ VMIME_TEST_SUITE_BEGIN(mailboxListTest) VASSERT_EQ("email", "email3@domain3.com", mboxList.getMailboxAt(2)->getEmail().generate()); } + void testBrokenGroup() { + + std::string bad(":,"); + + for (int i = 0 ; i < 10 ; ++i) { + bad = bad + bad; + } + + vmime::mailboxList mboxList; + mboxList.parse(bad); + + VASSERT_EQ("count", 0, mboxList.getMailboxCount()); + } + VMIME_TEST_SUITE_END -- cgit v1.2.3