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/options.c src/lib/options.c
index f926f53c1dd..f031de7302d 100644
--- src/lib/options.c
+++ src/lib/options.c
@@ -355,52 +355,62 @@
      ret = defaultVal;
 return ret;
 }
 
 int optionInt(char *name, int defaultVal)
 /* Return integer value of named option, or default value
  * if not set. */
 {
 char *s = optGet(name);
 char *valEnd;
 long lval;
 if (s == NULL)
     return defaultVal;
 if (sameString(s,"on"))
     return defaultVal;
+errno = 0;
 lval = strtol(s, &valEnd, 10);  // use strtol since strtoi does not exist
+if (errno == ERANGE) 
+    {
+    errnoAbort("optionInt strtol overflow or underflow in input string %s", s);
+    }
 if ((*s == '\0') || (*valEnd != '\0'))
     errAbort("value of -%s is not a valid integer: \"%s\"", name, s);
 if (lval > INT_MAX)
     errAbort("value of -%s is is too large: %ld, integer maximum is %d", name, lval, INT_MAX);
 if (lval < INT_MIN)
     errAbort("value of -%s is is too small: %ld, integer minimum is %d", name, lval, INT_MIN);
 return lval;
 }
 
 long long optionLongLong(char *name, long long defaultVal)
 /* Return long long value of named option, or default value
  * if not set. */
 {
 char *s = optGet(name);
 char *valEnd;
 long long val;
 if (s == NULL)
     return defaultVal;
 if (sameString(s,"on"))
     return defaultVal;
+errno = 0;
 val = strtoll(s, &valEnd, 10);
+if (errno == ERANGE) 
+    {
+    errnoAbort("optionLongLong strtoll overflow or underflow in input string %s", s);
+    }
 if ((*s == '\0') || (*valEnd != '\0'))
     errAbort("value of -%s is not a valid long long: \"%s\"", name, s);
 return val;
 }
 
 float optionFloat(char *name, float defaultVal)
 /* Return floating point value or default value if not set. */
 {
 char *s = optGet(name);
 char *valEnd;
 float val;
 if (s == NULL)
     return defaultVal;
 
 val = strtod(s, &valEnd);