summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2022-10-01 08:53:14 -0400
committerAllen Winter <allen.winter@kdab.com>2022-10-01 08:53:14 -0400
commitf92846be828092df4d1ad50647f9cf6a772eacbb (patch)
treecc279f52861c8b37a578a235cfe629ec3e8176e9
parentbc5c81e6ade001fb2b6a967660755c606f97923f (diff)
downloadlibical-git-f92846be828092df4d1ad50647f9cf6a772eacbb.tar.gz
regression.c - add test for segfault in icalcomponent_vanew with lastmodified property
see issue585
-rw-r--r--src/test/regression.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/test/regression.c b/src/test/regression.c
index 957b9c26..9bce2f63 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -4963,8 +4963,8 @@ static void test_comma_in_xproperty(void)
icalcomponent_free(c);
}
-void test_icaltime_as_timet(void) {
-
+void test_icaltime_as_timet(void)
+{
ok("icaltime_from_string translates 19020101T000000Z to -2145916800", icaltime_as_timet(icaltime_from_string("19020101T000000Z")) == -2145916800);
ok("icaltime_from_string translates 19290519T000000Z to -1281916800", icaltime_as_timet(icaltime_from_string("19290519T000000Z")) == -1281916800);
ok("icaltime_from_string translates 19561004T000000Z to -417916800", icaltime_as_timet(icaltime_from_string("19561004T000000Z")) == -417916800);
@@ -4986,6 +4986,21 @@ void test_icaltime_as_timet(void) {
#endif
}
+void test_icalcomponent_with_lastmodified(void)
+{
+ icalcomponent *comp;
+ struct icaltimetype lm = icaltime_from_timet_with_zone(1661280150, 0, NULL);
+
+ comp = icalcomponent_vanew(ICAL_VCALENDAR_COMPONENT,
+ icalproperty_new_version("2.0"),
+ icalproperty_new_prodid("PROD-ABC"),
+ icalproperty_new_uid("1234abcd"),
+ icalproperty_new_lastmodified(lm),
+ icalproperty_new_name("name1"),
+ 0);
+ free(comp);
+}
+
int main(int argc, char *argv[])
{
#if !defined(HAVE_UNISTD_H)
@@ -5130,6 +5145,7 @@ int main(int argc, char *argv[])
test_run("Test icalvalue resets timezone on set", test_icalvalue_resets_timezone_on_set, do_test, do_header);
test_run("Test removing TZID from DUE with icalcomponent_set_due", test_remove_tzid_from_due, do_test, do_header);
test_run("Test commas in x-property", test_comma_in_xproperty, do_test, do_header);
+ test_run("Test icalcomponent_vanew with lastmodified property", test_icalcomponent_with_lastmodified, do_test, do_header);
/** OPTIONAL TESTS go here... **/