e81403a315a24af601884b8a19e89bcecc92f267 galt Sat Dec 8 20:04:28 2018 -0800 Fixing hFindSplitTable and its use. Standard size, give real string size so no undetected overflows. Test result and abort if not found. Avoids SQL errors that otherwise will popup. Handles uninitialzed stack better for the output name. refs #22596. diff --git src/hg/hgc/lowelab.c src/hg/hgc/lowelab.c index b503203..8f918b4 100644 --- src/hg/hgc/lowelab.c +++ src/hg/hgc/lowelab.c @@ -466,31 +466,31 @@ int wordCount, x, length; int num = 0; int hits = 0; struct sqlConnection *conn = hAllocConn(database); struct sqlConnection *conn2; struct sqlConnection *spConn = NULL; struct COG *COG=NULL; struct COGXra *COGXra=NULL; char *temparray[160]; char *giwords[5]; char *spAcc = NULL; struct slName *el, *list; char *table = tdb->table; char *pdb = hPdbFromGdb(database); struct genePred *gpList = NULL, *gp = NULL; -char tableName[64]; +char tableName[HDB_MAX_TABLE_STRING]; boolean hasBin; int itemCount = 0; int arcogCount = 0; char genome[50] = ""; char clade[50] = ""; boolean hasArCOG; char treeFileName[256]; char treeTmpPsFileName[256]; char treePsFileName[256]; char treePngFileName[256]; char treePdfFileName[256]; char command[512]; char buffer[512]; char searchTerm[256]; @@ -568,31 +568,32 @@ printf("

\n"); printf("[Positions and Sequence]   \n"); printf("[COG]   \n"); printf("[Gene Ontology]   \n"); printf("[Protein Domain and Structure Infomation]   \n"); printf("[Gene Homology]   \n"); printf("[Pathway]
\n"); printf("

\n"); /* Positions and sequence */ printf("\n"); printf("\n"); printf("
\n"); printf("Positions and Sequence
\n"); -hFindSplitTable(database, seqName, table, tableName, &hasBin); +if (!hFindSplitTable(database, seqName, table, tableName, sizeof tableName, &hasBin)) + errAbort("track %s not found", table); sqlSafefFrag(query, sizeof(query), "name = \"%s\"", item); gpList = genePredReaderLoadQuery(conn, tableName, query); for (gp = gpList; gp != NULL; gp = gp->next) { sequence = hDnaFromSeq(database, gp->chrom, gp->txStart, gp->txEnd, dnaUpper); if (sequence != NULL) printf("GC content: %0.2f%%
\n", computeGCContent(sequence->dna, sequence->size)); } geneShowPosAndLinks(item, item, tdb, pepTableName, "htcTranslatedProtein", "htcGeneMrna", "htcGeneInGenome", "Predicted mRNA"); genePredFreeList(&gpList); printf("

\n"); /* COG */