Add test causing a segfault
The test creates an override pointing to itself, resulting in a stack
overflow.
@@ -66,6 +66,17 @@ static void test_cascadingLookup (void)
ksDel (ks);
}
+static void test_circularLinkLookup (void)
+{
+ printf ("Test circular link lookup\n");
+ KeySet * ks = ksNew (10, keyNew ("spec:/circular", KEY_META, "override/#0", "/circular", KEY_END), KS_END);
+ Key * search = keyNew ("/circular", KEY_END);
+ Key * found = ksLookup (ks, search, 0);
+ succeed_if (found == NULL, "found nonexistent key");
+ keyDel (search);
+ ksDel (ks);
+}
+
static void test_creatingLookup (void)
{
printf ("Test creating lookup\n");
@@ -564,6 +575,7 @@ int main (int argc, char ** argv)
test_ksToArray ();
test_ksRenameKeys ();
test_cascadingLookup ();
+ test_circularLinkLookup ();
test_creatingLookup ();
test_ksNoAlloc ();
test_ksRename ();
