cec5ead054791f2a6601f308a56d280c08bd8ef7
braney
  Fri Sep 4 13:32:36 2026 -0700
quickLift: do not take the lift path on half a pair of settings

A hub can set quickLiftDb without setting quickLiftUrl, and nothing filters hub
trackDb settings.  The alignment loaders gated on quickLiftDb alone, so such a
stanza took the lift path with no chain file and hgTracks died in
endsWith(NULL, ".bb") from bigChainGetLinkFile, by way of quickLiftLoadChains.
Verified: SIGSEGV in strlen from common.c:1653, page truncated mid-HTML.  This is
reachable on a production browser now that bigChain and bigMaf are liftable,
because those carry their own bigDataUrl and so need no trustTrackDb.

quickLiftIsLifted requires both halves, and every gate now uses it, which also
settles the two different predicates that were in use for the same question.
quickLiftLoadChains returns an empty list for a NULL file as well, so the older
bed and genePred callers are covered whatever their gate does.

quickLiftSql now checks that a row has at least as many columns as the loader is
going to read.  The native psl loader has always checked this, and the quickLift
path replacing it did not, so a table of the wrong type walked off the end of the
row; the psl caller now states the 21 columns it needs.

quickLiftMafs held a maf component name in a fixed buffer through safecpy, which
aborts rather than truncates, so a long name from a hub took hgTracks down.  It
clones instead.

htcBigPslAliInWindow used a trackDb pointer its lookup can leave NULL, which its
sibling htcBigPslAli already checked for.  And aliTrackParam formats a URL
parameter into a fixed buffer with safef, which aborts on a long one.

refs #38249

diff --git src/hg/hgTracks/chainTrack.c src/hg/hgTracks/chainTrack.c
index 8b45b276f46..456493972fa 100644
--- src/hg/hgTracks/chainTrack.c
+++ src/hg/hgTracks/chainTrack.c
@@ -484,31 +484,31 @@
 slReverse(&list);
 if (tg->visibility != tvDense)
     slSort(&list, linkedFeaturesCmpStart);
 else if (chainCart->chainColor == chainColorScoreColors)
     slSort(&list, chainCmpScore);
 tg->items = list;
 
 maybeLoadSnake(tg);
 }
 
 void bigChainLoadItems(struct track *tg)
 /* Load up all of the chains from correct table into tg->items
  * item list.  At this stage to conserve memory for other tracks
  * we don't load the links into the components list until draw time. */
 {
-if ((trackDbSetting(tg->tdb, "quickLiftDb") != NULL) && !quickLiftIsOwnChainTrack(tg->tdb))
+if (quickLiftIsLifted(tg->tdb) && !quickLiftIsOwnChainTrack(tg->tdb))
     {
     quickLiftChainLoadItems(tg);
     return;
     }
 
 boolean doSnake = cartOrTdbBoolean(cart, tg->tdb, "doSnake" , FALSE);
 struct linkedFeatures *list = NULL, *lf;
 int qs;
 char *optionChrStr;
 struct cartOptions *chainCart;
 
 chainCart = (struct cartOptions *) tg->extraUiData;
 
 optionChrStr = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE,
 	"chromFilter");
@@ -571,31 +571,31 @@
 else
     slReverse(&list);
 tg->items = list;
 
 bbiFileClose(&bbi);
 
 loadLinks(tg, winStart, winEnd, tvFull);
 maybeLoadSnake(tg);
 }
 
 void chainLoadItems(struct track *tg)
 /* Load up all of the chains from correct table into tg->items
  * item list.  At this stage to conserve memory for other tracks
  * we don't load the links into the components list until draw time. */
 {
-if ((trackDbSetting(tg->tdb, "quickLiftDb") != NULL) && !quickLiftIsOwnChainTrack(tg->tdb))
+if (quickLiftIsLifted(tg->tdb) && !quickLiftIsOwnChainTrack(tg->tdb))
     {
     quickLiftChainLoadItems(tg);
     return;
     }
 
 boolean doSnake = cartOrTdbBoolean(cart, tg->tdb, "doSnake" , FALSE);
 char *table = tg->table;
 struct chain chain;
 int rowOffset;
 char **row;
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr = NULL;
 struct linkedFeatures *list = NULL, *lf;
 int qs;
 char *optionChrStr;