summaryrefslogtreecommitdiff
path: root/src/test/regression.c
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2016-11-28 10:38:38 -0500
committerAllen Winter <allen.winter@kdab.com>2016-11-28 10:38:38 -0500
commitaf3463b1a996d097f9fb26a2b28092eb0ac05bde (patch)
treed5c57627c79229de761b929ac816111b726d64ed /src/test/regression.c
parentd2de4b2d7d87988aa86c9f409922334cebe7c655 (diff)
downloadlibical-git-af3463b1a996d097f9fb26a2b28092eb0ac05bde.tar.gz
test/regression.c - test a really bad calendar that might cause a CVE
Diffstat (limited to 'src/test/regression.c')
-rw-r--r--src/test/regression.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/regression.c b/src/test/regression.c
index cf69ff7a..b1f8963e 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -450,6 +450,16 @@ const char *good_child =
" Common Name 4:Another Comment\r\n"
"X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:This is only a test\r\n" "END:VEVENT\r\n";
+const char *bad_child =
+ "BEGIN;\r\n"
+ "TZNAME:\\r\n"
+ "TZNAME:\\r\n"
+ "TZNAME:\\r\n"
+ "TZNAME:\\r\n"
+ "TZNAME:\\r\n"
+ "TZNAME:\\r\n"
+ "TZNAME:\\r\n";
+
void test_components()
{
icalcomponent *c;
@@ -492,6 +502,13 @@ void test_components()
str_is("test results of child component", icalcomponent_as_ical_string(child), good_child);
icalcomponent_free(c);
+
+ int estate = icalerror_get_errors_are_fatal();
+ icalerror_set_errors_are_fatal(0);
+ c = icalcomponent_new_from_string(bad_child);
+ ok("parse failed as expected", (c == NULL));
+ icalcomponent_free(c);
+ icalerror_set_errors_are_fatal(estate);
}
void test_memory()