summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-04-24 16:49:34 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-04-24 16:49:34 (GMT)
commit553caf0d2c710467bff3d7916f6e2e50e899768f (patch)
tree5b5b57f12e7db8e599064bf8a63465433eacde9c /generic/tclBinary.c
parent87e417c1a1ce9d369c4a846403c4d8799b4c8374 (diff)
downloadtcl-553caf0d2c710467bff3d7916f6e2e50e899768f.zip
tcl-553caf0d2c710467bff3d7916f6e2e50e899768f.tar.gz
tcl-553caf0d2c710467bff3d7916f6e2e50e899768f.tar.bz2
Fix [9369f83649] - binary format/scan for big data
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r--generic/tclBinary.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 3a9d62e..e0bfd46 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -870,7 +870,7 @@ BinaryFormatCmd(
int value = 0; /* Current integer value to be packed.
* Initialized to avoid compiler warning. */
char cmd; /* Current format character. */
- Tcl_Size count; /* Count associated with current format
+ Tcl_Size count; /* Count associated with current format
* character. */
int flags; /* Format field flags */
const char *format; /* Pointer to current position in format
@@ -1383,7 +1383,7 @@ BinaryScanCmd(
int value = 0; /* Current integer value to be packed.
* Initialized to avoid compiler warning. */
char cmd; /* Current format character. */
- Tcl_Size count; /* Count associated with current format
+ Tcl_Size count; /* Count associated with current format
* character. */
int flags; /* Format field flags */
const char *format; /* Pointer to current position in format
@@ -1795,14 +1795,14 @@ GetFormatSpec(
(*formatPtr)++;
*countPtr = BINARY_ALL;
} else if (isdigit(UCHAR(**formatPtr))) { /* INTL: digit */
- unsigned long count;
+ unsigned long long count;
errno = 0;
- count = strtoul(*formatPtr, (char **) formatPtr, 10);
- if (errno || (count > (unsigned long) INT_MAX)) {
- *countPtr = INT_MAX;
+ count = strtoull(*formatPtr, (char **) formatPtr, 10);
+ if (errno || (count > TCL_SIZE_MAX)) {
+ *countPtr = TCL_SIZE_MAX;
} else {
- *countPtr = (int) count;
+ *countPtr = count;
}
} else {
*countPtr = BINARY_NOCOUNT;