a5b8db176c6bd1cca6e542bf57080cfc7c9b29e8 braney Wed Aug 19 18:08:20 2026 -0700 vcfTrack: only abbreviate an allele that is longer than the per-allele display budget, refs #38154 diff --git src/hg/hgTracks/vcfTrack.c src/hg/hgTracks/vcfTrack.c index 844600a64c0..6dedc243815 100644 --- src/hg/hgTracks/vcfTrack.c +++ src/hg/hgTracks/vcfTrack.c @@ -318,31 +318,33 @@ if (len > maxLen) { int maxAlLen = (maxLen / min(rec->alleleCount, maxAlCount)) - 1; pgs->name[0] = '\0'; int i; for (i = 0; i < rec->alleleCount; i++) { if (i > 0) safencat(pgs->name, len+1, "/", 1); if (i >= maxAlCount) { safecat(pgs->name, len+1, "..."); pgs->alleleCount = maxAlCount; break; } - if (strlen(rec->alleles[i]) > maxAlLen-3) + // Only shorten an allele that is actually too long: the "..." plus its + // terminating null needs the allele buffer to hold maxAlLen+1 bytes. + if (strlen(rec->alleles[i]) > maxAlLen) strcpy(rec->alleles[i]+maxAlLen-3, "..."); safencat(pgs->name, len+1, rec->alleles[i], maxAlLen); } } slAddHead(&pgsList, pgs); } slReverse(&pgsList); return pgsList; } // Center-weighted alpha clustering of haplotypes -- see Redmine #3711, #2823 note 7 // It might be nice to use an allele-frequency representation here instead of [ACGTN] strings // with "N" for missing info or differences, but keep it simple.