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/hgGenome/wiggle.c src/hg/hgGenome/wiggle.c
index 7c10f98..1b5b3b1 100644
--- src/hg/hgGenome/wiggle.c
+++ src/hg/hgGenome/wiggle.c
@@ -42,62 +42,61 @@
 	}
     else
 	{
 	struct hTableInfo *hti = maybeGetHti(db, table);
 	typeWiggle = (hti != NULL && HTI_IS_WIGGLE);
 	}
     }
 return(typeWiggle);
 }
 
 
 struct wiggleDataStream *wigChromRawStats(char *chrom)
 /* Fetch stats for wig data in chrom.  
  * Returns a wiggleDataStream, free it with wiggleDataStreamFree() */
 {
-char splitTableOrFileName[256];
+char splitTableOrFileName[HDB_MAX_TABLE_STRING];
 struct customTrack *ct = NULL;
 boolean isCustom = FALSE;
 struct wiggleDataStream *wds = NULL;
 int operations = wigFetchRawStats;
 char *table = curTable;
 
 /* ct, isCustom, wds are set here */
 if (isCustomTrack(table)) 
     { 
     ct = lookupCt(table); 
     isCustom = TRUE; 
     if (! ct->wiggle) 
 	errAbort("called to work on a custom track '%s' that isn't wiggle data ?", table); 
  
     if (ct->dbTrack) 
-	safef(splitTableOrFileName,ArraySize(splitTableOrFileName), "%s", 
-		ct->dbTableName); 
+	safef(splitTableOrFileName, sizeof splitTableOrFileName, "%s", ct->dbTableName); 
     else 
-	safef(splitTableOrFileName,ArraySize(splitTableOrFileName), "%s", 
-		ct->wigFile); 
+	safef(splitTableOrFileName, sizeof splitTableOrFileName, "%s", ct->wigFile); 
     } 
 
 wds = wiggleDataStreamNew(); 
 
 wds->setChromConstraint(wds, chrom);
 
 if (isCustom)
     {
     if (ct->dbTrack)
 	wds->getData(wds, CUSTOM_TRASH, splitTableOrFileName, operations);
     else
 	wds->getData(wds, NULL, splitTableOrFileName, operations);
     }
 else
     {
-    boolean hasBin = FALSE;
-    if (hFindSplitTable(database, chrom, table, splitTableOrFileName, &hasBin))
+    if (hFindSplitTable(database, chrom, table, splitTableOrFileName, sizeof splitTableOrFileName, NULL))
 	{
 	wds->getData(wds, database, splitTableOrFileName, operations);
 	}
+    else
+	errAbort("Track %s not found", table);
     }
 return wds;
 }