f4acfa770ad691ea4bb4fc08d91d4d9d13b32a7a braney Fri Jun 12 08:19:18 2026 -0700 hgConvert: avoid SIGSEGV when position missing from cart doMiddle() read the position with cartString(), which aborts via hashMustFindVal when a request arrives with a db but no position in the cart (e.g. a bot hitting hgConvert with no prior browsing). Set up the cart and database first, then read the position with the assembly's default position as a fallback, matching the pattern in hgTracks. refs #37535 Co-Authored-By: Claude Opus 4.8 (1M context) diff --git src/hg/hgConvert/hgConvert.c src/hg/hgConvert/hgConvert.c index 0a45bd01cca..c2d42220831 100644 --- src/hg/hgConvert/hgConvert.c +++ src/hg/hgConvert/hgConvert.c @@ -727,35 +727,37 @@ for (this = list; this != NULL; this = next) { next = this->next; if (hashLookup(dbDbHash, this->toDb) || startsWith("GC", this->toDb)) slAddHead(&cleanList, this); else liftOverChainFree(&this); } slReverse(&cleanList); return cleanList; } static void doMiddle(struct cart *theCart) /* Set up globals and make web page */ { -char *fromPos = cartString(theCart, "position"); - cart = theCart; getDbAndGenome(cart, &database, &organism, oldVars); +// Bots sometimes hit hgConvert with a db but no position in the cart; fall +// back to the assembly's default position rather than aborting. +char *fromPos = cartUsualString(cart, "position", hDefaultPos(database)); + // Try to deal with virt chrom position used by hgTracks. if (startsWith( MULTI_REGION_CHROM, cartUsualString(cart, "position", "")) || startsWith(OLD_MULTI_REGION_CHROM, cartUsualString(cart, "position", ""))) cartSetString(cart, "position", cartUsualString(cart, "nonVirtPosition", "")); if (cartVarExists(cart, HGLFT_DO_CONVERT)) doConvert(fromPos); else { struct liftOverChain *checkLiftOverList = liftOverChainListForDbFiltered(trackHubSkipHubName(database)); struct liftOverChain *liftOverList = cleanLiftOverList(checkLiftOverList); struct liftOverChain *choice = defaultChoices(liftOverList, organism, trackHubSkipHubName(database)); if (choice == NULL) errAbort("Sorry, no conversions available from this assembly."); struct dbDb *dbList, *fromDb, *toDb;