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/das/das.c src/hg/das/das.c index 6d7d1b1..e4429e1 100644 --- src/hg/das/das.c +++ src/hg/das/das.c @@ -876,31 +876,32 @@ dasOutBed(chrom, sqlUnsigned(chromStart), sqlUnsigned(chromEnd), name, score, strand, td, tt); } } static void writeSegmentFeaturesTable(struct segment *segment, struct tableDef *td, struct hash *trackHash, struct sqlConnection *conn) /* write segments features for a table */ { int rowOffset; boolean hasBin; char table[HDB_MAX_TABLE_STRING]; verbose(2, "track %s\n", td->name); -hFindSplitTable(database, segment->seq, td->name, table, &hasBin); +if (!hFindSplitTable(database, segment->seq, td->name, table, sizeof table, &hasBin)) + errAbort("track %s not found", td->name); // horrible hack because hFindSplitTable and hRangeQuery don't really seem to // handle est->all_est/mrna->all_mrna right, but markd fears modifying that // code if (sameString(td->name, "mrna")) safecpy(table, sizeof(table), "all_mrna"); else if (sameString(td->name, "est")) safecpy(table, sizeof(table), "all_est"); struct trackTable *tt = hashFindVal(trackHash, td->name); struct sqlResult *sr = hRangeQuery(conn, table, segment->seq, segment->start, segment->end, NULL, &rowOffset); // FIXME: should use trackDb to determine type, as field names are // not always unique. if (sameString(td->startField, "tStart") && (sqlFieldColumn(sr, "qStart") >= 0)) { dasOutPslSegment(sr, rowOffset, td, tt); }