e8bcc824054ba0105ecb7d006e83c06b6a7dc00b markd Thu Feb 20 20:49:46 2014 -0800 Fixed bug in validating GFF3 attribute tag names. diff --git src/lib/gff3.c src/lib/gff3.c index a8288f0..5a977bc 100644 --- src/lib/gff3.c +++ src/lib/gff3.c @@ -331,31 +331,34 @@ #if 0 // spec unclear; bug report filed // spec currently doesn't restrict phase, unclear if it's allowed on start/stop codon features if (g3a->phase >= 0) gff3AnnErr(g3a, "phase only allowed on CDS features"); #endif } } /* check that an attribute tag name is valid. */ static boolean checkAttrTag(struct gff3Ann *g3a, char *tag) { // FIXME: spec is not clear on what is a valid tag. char *tc = tag; boolean isOk = isalpha(*tc); for (tc++; isOk && (*tc != '\0'); tc++) - isOk = (*tc == '_') || isalnum(*tc); + { + if (!((*tc == '_') || isalnum(*tc))) + isOk = FALSE; + } if (!isOk) gff3AnnErr(g3a, "invalid attribute tag, must start with an alphabetic character and be composed of alphanumeric or underscore characters: %s", tag); return isOk; } static struct slName *parseAttrVals(struct gff3Ann *g3a, char *tag, char *valsStr) /* parse an attribute into its values */ { int i, numVals = chopString(valsStr, ",", NULL, 0); char **vals = needMem((numVals+1)*sizeof(char**)); // +1 allows for no values chopString(valsStr, ",", vals, numVals); struct slName *unescVals = NULL; for (i = 0; i < numVals; i++) slAddHead(&unescVals, unescapeSlName(g3a, vals[i])); if (unescVals == NULL)