15080c151c9929733fa2af71ce5dc98533c4f913 galt Fri Mar 20 18:45:40 2026 -0700 The error messages are more detailed to help users, something MarkD wanted. It aborts by default if chromStart or chromEnd are greater than chromSize, unless the user has specified -skipChromCheck which skips both chrom name and chrom size checks now. Fixes issues with undetected overflowing integers issues, warns when they are too large instead of silently failing. Expanded the all the coordinates in the utils and the lib so that they use full range of unsigned integer space when querying and using GB for chromStart and chromEnd coordinates used by BED standard and supported by .2bit chroms. Fixed minor overflow issue with bigBed.c going past the end of the 4GB space. I made changes to bigBedToBed.c and then used CLAUDE prompt to refactor those changes into the 6 other utilities bigMafToMaf, bigChainToChain, bigGenePredToGenePred, bigPslToPsl, bigWigToBedGraph, bigWigToWig. refs #28109 diff --git src/lib/bigBed.c src/lib/bigBed.c index 134e2eff5d8..6f24d65bd0e 100644 --- src/lib/bigBed.c +++ src/lib/bigBed.c @@ -7,60 +7,61 @@ #include "common.h" #include "hash.h" #include "linefile.h" #include "obscure.h" #include "dystring.h" #include "rangeTree.h" #include "cirTree.h" #include "bPlusTree.h" #include "basicBed.h" #include "asParse.h" #include "zlibFace.h" #include "sig.h" #include "udc.h" #include "bbiFile.h" #include "bigBed.h" +#include <limits.h> struct bbiFile *bigBedFileOpenAlias(char *fileName, aliasFunc aliasFunc) /* Open up big bed file with chrom alias hash. */ { return bbiFileOpenAlias(fileName, bigBedSig, "big bed", aliasFunc); } struct bbiFile *bigBedFileOpen(char *fileName) /* Open up big bed file. */ { return bigBedFileOpenAlias(fileName, NULL); } boolean bigBedFileCheckSigs(char *fileName) /* check file signatures at beginning and end of file */ { return bbiFileCheckSigs(fileName, bigBedSig, "big bed"); } struct bigBedInterval *bigBedIntervalQuery(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end, int maxItems, struct lm *lm) /* Get data for interval. Return list allocated out of lm. Set maxItems to maximum * number of items to return, or to 0 for all items. */ { struct bigBedInterval *el, *list = NULL; int itemCount = 0; bbiAttachUnzoomedCir(bbi); // Find blocks with padded start and end to make sure we include zero-length insertions: bits32 paddedStart = (start > 0) ? start-1 : start; -bits32 paddedEnd = end+1; +bits32 paddedEnd = (end < UINT_MAX) ? end+1 : end; bits32 chromId; struct fileOffsetSize *blockList = bbiOverlappingBlocks(bbi, bbi->unzoomedCir, chrom, paddedStart, paddedEnd, &chromId); struct fileOffsetSize *block, *beforeGap, *afterGap; struct udcFile *udc = bbi->udc; boolean isSwapped = bbi->isSwapped; /* Set up for uncompression optionally. */ char *uncompressBuf = NULL; if (bbi->uncompressBufSize > 0) uncompressBuf = needLargeMem(bbi->uncompressBufSize); char *mergedBuf = NULL; for (block = blockList; block != NULL; ) {