90dc829b2d87b15c4fc4bbc1d814f83d1274ef52 braney Fri Sep 4 14:00:05 2026 -0700 Pass element counts, not byte sizes, to the chop routines chopByWhite, chopString and chopByChar take their last argument as a count of elements in the output array. Fifteen call sites passed sizeof(array) instead. For an array of pointers that is eight times the real capacity on a 64-bit build, so the chop could write well past the end of the array. Switched each to ArraySize(). Behaviour is unchanged for any input that already fitted in the array. Built clean: lib, hg/lib, hg/hgTracks, hg/hgc, hg/utils/hubCheck, utils/bedScore, parasol/lib, parasol/parasol. Three directories do not build, but they fail the same way without this change: checkExp is missing htslib link flags, and cgapSageFind and affySplice have stale prototypes in files this does not touch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> diff --git src/hg/hgc/lowelab.c src/hg/hgc/lowelab.c index e6d06e6ca8e..5103ac2d64c 100644 --- src/hg/hgc/lowelab.c +++ src/hg/hgc/lowelab.c @@ -872,31 +872,31 @@ "ModBase structure for the protein. The ModBase structure " "frequently covers just a fragment of the protein. You may " "be asked to log onto ModBase the first time you click on the " "pictures. It is simplest after logging in to just click on " "the picture again to get to the specific info on that model.</I><p>"); } printf("</td></tr></tbody></table><br>\n"); /* Gene Homology */ printf("<table style=\"text-align: left; width: 99%%;\" border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"); printf("<tbody><tr><td style=\"background-color:#eee9e9;\">\n"); printf("<a name=\"homology\"></a><b>Gene Homology</b><br></td></tr>\n"); printf("<tr><td>\n"); /* ncbi blast hits */ -hits = chopString(gi,":",giwords,sizeof(giwords)); +hits = chopString(gi,":",giwords,ArraySize(giwords)); if (hits > 0) { printf("<B>NCBI Blast Hits:</B> " "<A HREF=\"http://www.ncbi.nlm.nih.gov/sutils/blink.cgi?pid=%s\" " "TARGET=_BLANK>%s</A><BR>\n", (hits == 2) ? giwords[1] : giwords[0], (hits == 2) ? giwords[1] : giwords[0]); } /* Gene tree */ safef(treeFileName, sizeof(treeFileName), "../trash/geneTree/geneTree_%s.txt", item); if (getGeneTree(conn, item, treeFileName)) { safef(treeTmpPsFileName, sizeof(treeTmpPsFileName), "../trash/geneTree/tmp_geneTree_%s.ps", item); safef(treePsFileName, sizeof(treePsFileName), "../trash/geneTree/geneTree_%s.ps", item); safef(treePngFileName, sizeof(treePngFileName), "../trash/geneTree/geneTree_%s.png", item);