2727d941e00bc74cc9fe53851ccc16172965646d hiram Tue Sep 29 22:35:07 2026 -0700 a track name too long caused a buffer overflow, claude advice here fixes this problem, track to test is in GenArk assembly GCA_020740595.1 in the "LiftOver Ring-tailed lemur (2021-11-04) minimap2 Lift Over Chained Alignments" track refs #34360 diff --git src/hg/hgTracks/chainTrack.c src/hg/hgTracks/chainTrack.c index dd3ad391498..4db0a2984c9 100644 --- src/hg/hgTracks/chainTrack.c +++ src/hg/hgTracks/chainTrack.c @@ -136,31 +136,31 @@ sqlFreeResult(&sr); dyStringFree(&query); } static void loadLinks(struct track *tg, int seqStart, int seqEnd, enum trackVisibility vis) { struct linkedFeatures *lf; struct simpleFeature *sf; struct lm *lm; struct hash *hash; /* Hash of chain ids. */ #ifdef OLD double scale = ((double)(winEnd - winStart))/width; #endif /* OLD */ -char fullName[64]; +char fullName[HDB_MAX_TABLE_STRING]; int start, end, extra; struct simpleFeature *lastSf = NULL; int maxOverLeft = 0, maxOverRight = 0; int overLeft, overRight; void *closure; struct sqlClosure sqlClosure; struct bbClosure bbClosure; linkRetrieveFunc queryFunc; if (tg->isBigBed) { closure = &bbClosure; queryFunc = doBbQuery; char *fileName = trackDbSetting(tg->tdb, "linkDataUrl"); if (fileName == NULL) { @@ -214,37 +214,43 @@ #ifdef OLD else { lmAllocVar(lm, sf); sf->start = lf->start; sf->end = lf->end; sf->grayIx = lf->grayIx; lf->components = sf; } #endif /* OLD */ } /* if some chains are actually loaded */ if (hash->elCount) { - boolean isSplit = TRUE; - /* Make up range query. */ - safef(fullName, sizeof fullName, "%s_%s", chromName, tg->table); - if (tg->isBigBed || !hTableExists(database, fullName)) + boolean isSplit = FALSE; + /* Make up range query. A bigChain's links come from its own file, so the split + * chrom_table name is only needed for native database tables. */ + safecpy(fullName, sizeof fullName, tg->table); + if (!tg->isBigBed) { - strcpy(fullName, tg->table); - isSplit = FALSE; + char splitName[HDB_MAX_TABLE_STRING]; + safef(splitName, sizeof splitName, "%s_%s", chromName, tg->table); + if (hTableExists(database, splitName)) + { + safecpy(fullName, sizeof fullName, splitName); + isSplit = TRUE; + } } /* in dense mode we don't draw the lines * so we don't need items off the screen */ if (vis == tvDense) queryFunc(closure, fullName, lm, hash, seqStart, seqEnd, NULL, isSplit); else { /* if chains extend beyond edge of window we need to get * elements that are off the screen * in both directions so we know whether to draw * one or two lines to the edge of the screen. */ #define STARTSLOP 10000