fa3b40b33e1b5267d7e073caac3de15f82cac3cd angie Tue Jan 7 09:46:12 2014 -0800 Oops, as Jonathan pointed out, VCF 4.0 can still have meta-information lineswithout '='. fixes #12417 diff --git src/lib/vcf.c src/lib/vcf.c index 8b43371..b34146f 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -270,31 +270,32 @@ { (void)strSwapStrs(line, strlen(line)+1, "\342\200\234", "\""); (void)strSwapStrs(line, strlen(line)+1, "\342\200\235", "\""); } static void parseMetadataLine(struct vcfFile *vcff, char *line) /* Parse a VCF header line beginning with "##" that defines a metadata. */ { char *ptr = line; if (ptr == NULL && !startsWith(ptr, "##")) errAbort("Bad line passed to parseMetadataLine"); ptr += 2; char *firstEq = strchr(ptr, '='); if (firstEq == NULL) { - if (vcff->majorVersion >= 4) + if (vcff->majorVersion > 4 || + (vcff->majorVersion == 4 && vcff->minorVersion > 0)) vcfFileErr(vcff, "Metadata line lacks '=': \"%s\"", line); return; } regmatch_t substrs[8]; // Some of the metadata lines are crucial for parsing the rest of the file: if (startsWith("##fileformat=", line) || startsWith("##format", line)) { if (regexMatchSubstr(line, fileformatRegex, substrs, ArraySize(substrs))) { // substrs[2] is major version #, substrs[3] is set only if there is a minor version, // and substrs[4] is the minor version #. vcff->majorVersion = atoi(line + substrs[2].rm_so); if (substrs[3].rm_so != -1) vcff->minorVersion = atoi(line + substrs[4].rm_so); }