335d4c88dcce7148ccb0f6df4a18a2881b2075f7
markd
  Wed Jan 24 11:34:06 2024 -0800
Check number of columns when reading auxillary tab files. This caused use of uninitialized memory, inserting garbage and ocassional newlines in BED file

diff --git src/hg/utils/genePredToBigGenePred/genePredToBigGenePred.c src/hg/utils/genePredToBigGenePred/genePredToBigGenePred.c
index d7e79cc..ddd7fb3 100644
--- src/hg/utils/genePredToBigGenePred/genePredToBigGenePred.c
+++ src/hg/utils/genePredToBigGenePred/genePredToBigGenePred.c
@@ -164,74 +164,74 @@
 FILE *fp = mustOpen(bigGeneOutput, "w");
 
 for(; gp ; gp = gp->next)
     {
     outBigGenePred(fp, gp);
     }
 
 }
 
 
 struct hash *hashCds(char *fileName)
 {
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[5];
 struct hash *hash = hashNew(16);
-while (lineFileChopTab(lf, row))
+while (lineFileNextRowTab(lf, row, ArraySize(row)))
     {
     char *name = row[0];
     struct cds *cds;
     lmAllocVar(hash->lm, cds );
     cds->cdsStartStat = atoi(row[1]);
     cds->cdsEndStat = atoi(row[2]);
     cds->exonCount = atoi(row[3]);
     //  this memory will be leaked if the hash is free'd
     int numBlocks;
     sqlSignedDynamicArray(row[4], &cds->exonFrames, &numBlocks);
     assert(numBlocks == cds->exonCount);
     hashAdd(hash, name, cds);
     }
 lineFileClose(&lf);
 return hash;
 }
 
 struct hash *hashGeneNames(char *fileName)
 /* Given a three column file (key, geneName, geneName2) return a hash. */
 {
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[3];
 struct hash *hash = hashNew(16);
-while (lineFileChopTab(lf, row))
+while (lineFileNextRowTab(lf, row, ArraySize(row)))
     {
     char *name = row[0];
     struct geneNames *gn;
     lmAllocVar(hash->lm, gn);
     gn->name = lmCloneString(hash->lm, row[1]);
     gn->name2 = lmCloneString(hash->lm, row[2]);
     hashAdd(hash, name, gn);
     }
 lineFileClose(&lf);
 return hash;
 }
 
 struct hash *hashColors(char *fileName)
 /* Given a four column file (key, r, g, b) return a hash. */
 {
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[4];
 struct hash *hash = hashNew(16);
-while (lineFileChopTab(lf, row))
+while (lineFileNextRowTab(lf, row, ArraySize(row)))
     {
     char *name = row[0];
     struct rgbColor *color;
     lmAllocVar(hash->lm, color);
     color->r = atoi(row[1]);
     color->g = atoi(row[2]);
     color->b = atoi(row[3]);
     color->a = 255;
     hashAdd(hash, name, color);
     }
 lineFileClose(&lf);
 return hash;
 }
 
 int main(int argc, char *argv[])