c41c17e6c7251f5f93f68ad8e80ab6b0d0f348f6
markd
  Mon Jul 10 15:56:23 2023 -0700
fixed SEGV with checking certain invalid GFF3s

diff --git src/lib/gff3.c src/lib/gff3.c
index 05aad9c..18e05cc 100644
--- src/lib/gff3.c
+++ src/lib/gff3.c
@@ -932,36 +932,37 @@
 int cnt = 0;
 for (; g3a != NULL; g3a = g3a->nextPart)
     cnt++;
 return cnt;
 }
 
 static void discontinFeatureCheck(struct gff3Ann *g3a)
 /* sanity check linked gff3Ann discontinuous features */
 {
 // Add non-spec restriction on only one parent id to make parent id checks easier
 
 if (slCount(g3a->parentIds) != 1)
     gff3AnnErr(g3a, FALSE, "Annotation records for discontinuous features with ID=\"%s\" must have one and only one parent", g3a->id);
 for (struct gff3Ann *g3a2 = g3a->nextPart; (g3a2 != NULL) && !gff3FileStopDueToErrors(g3a->file); g3a2 = g3a2->nextPart)
     {
-    if (!sameString(g3a->type, g3a2->type))
-        gff3AnnErr(g3a, FALSE, "Annotation records for discontinuous features with ID=\"%s\" do not have the same type, found \"%s\" and \"%s\"", g3a->id, g3a->type, g3a2->type);
-    if (!sameString(g3a->type, g3a2->type))
-        gff3AnnErr(g3a, FALSE, "Annotation records for discontinuous features with ID=\"%s\" do not have the same type, found \"%s\" and \"%s\"", g3a->id, g3a->type, g3a2->type);
-    if ((slCount(g3a2->parentIds) != 1) || !sameString(g3a2->parentIds->name, g3a->parentIds->name))
-        gff3AnnErr(g3a, FALSE, "Annotation records for discontinuous features with ID=\"%s\" must have same parent", g3a->id);
+    if (slCount(g3a2->parentIds) != 1)
+        gff3AnnErr(g3a2, FALSE, "Annotation records for discontinuous features with ID=\"%s\" must have one and only one parent", g3a2->id);
+    else if (!sameString(g3a->type, g3a2->type))
+        gff3AnnErr(g3a2, FALSE, "Annotation records for discontinuous features with ID=\"%s\" do not have the same type, found \"%s\" and \"%s\"", g3a->id, g3a->type, g3a2->type);
+    else if (!sameString(g3a2->parentIds->name, g3a->parentIds->name))
+        gff3AnnErr(g3a2, FALSE, "Annotation records for discontinuous features with ID=\"%s\" must have same parent, found: \"%s\" and \"%s\"", g3a->id,
+                   g3a2->parentIds->name, g3a->parentIds->name);
     }
 
 // The discontinuous features abomination means we can't check for duplicate
 // ids in features were it makes no sense. Add non-spec restriction.
 if (!(sameString(g3a->type, gff3FeatCDS) ||
       sameString(g3a->type, gff3FeatThreePrimeUTR) ||
       sameString(g3a->type, gff3FeatFivePrimeUTR) ||
       sameString(g3a->type, gff3FeatStartCodon) ||
       sameString(g3a->type, gff3FeatStopCodon)))
     gff3AnnErr(g3a, FALSE, "Incorrect duplicated ID=\"%s\" or attempt to create discontinuous features for type \"%s\"",
                g3a->id, g3a->type);
 }
 
 static void discontinFeatureFillArray(struct gff3Ann *g3a, int numAnns, struct gff3Ann *featAnns[])
 /* convert list to array for sorting */