diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-11-16 19:26:36 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-11-16 19:26:36 (GMT) |
commit | 6e58f7f8285772ed1ef416a69f90336845976898 (patch) | |
tree | 3ba8ddaa09be1335a05e3bef45b0eeb4aaf3e6e8 /generic/tclCmdMZ.c | |
parent | 901304bbca1724418fb8682d1594703e989589e2 (diff) | |
download | tcl-6e58f7f8285772ed1ef416a69f90336845976898.zip tcl-6e58f7f8285772ed1ef416a69f90336845976898.tar.gz tcl-6e58f7f8285772ed1ef416a69f90336845976898.tar.bz2 |
Fix binary/format/string testcase failures on 32-bit platforms. Reported by Harald Oehlmann.
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index eecf675..7231548 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2642,7 +2642,8 @@ StringEqualCmd( const char *string2; int i, match, nocase = 0; - Tcl_Size length, reqlength = -1; + Tcl_Size length; + Tcl_WideInt reqlength = -1; if (objc < 3 || objc > 6) { str_cmp_args: @@ -2661,9 +2662,12 @@ StringEqualCmd( goto str_cmp_args; } i++; - if (TclGetSizeIntFromObj(interp, objv[i], &reqlength) != TCL_OK) { + if (Tcl_GetWideIntFromObj(interp, objv[i], &reqlength) != TCL_OK) { return TCL_ERROR; } + if ((Tcl_WideUInt)reqlength > TCL_SIZE_MAX) { + reqlength = -1; + } } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": must be -nocase or -length", @@ -2741,8 +2745,8 @@ StringCmpOpts( int i; Tcl_Size length; const char *string; + Tcl_WideInt wreqlength = -1; - *reqlength = -1; *nocase = 0; if (objc < 3 || objc > 6) { str_cmp_args: @@ -2761,9 +2765,14 @@ StringCmpOpts( goto str_cmp_args; } i++; - if (TclGetSizeIntFromObj(interp, objv[i], reqlength) != TCL_OK) { + if (Tcl_GetWideIntFromObj(interp, objv[i], &wreqlength) != TCL_OK) { return TCL_ERROR; } + if ((Tcl_WideUInt)wreqlength > TCL_SIZE_MAX) { + *reqlength = -1; + } else { + *reqlength = wreqlength; + } } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": must be -nocase or -length", |