Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-08-23
13:46 • Ticket [dd14ad7824] String is integer/wide do not seem to check the correct rang... artifact: 61cf07e771 user: dkf
2015-12-01
12:43 • Closed ticket [dd14ad7824]. artifact: 3d63e9959e user: jan.nijtmans
2015-11-09
19:40 • Ticket [dd14ad7824]: 4 changes artifact: 68a03ab4f4 user: dgp
11:18 • Ticket [dd14ad7824]: 6 changes artifact: b0ab1d7dbf user: sebres
10:14 • New ticket [dd14ad7824]. artifact: 1b80808862 user: apnadkarni

String is integer/wide do not seem to check the correct ranges

Closed / Invaliddd14ad78248c6b4930fad6de2995cb86cab926e8Created 11 years agoUpdated 10 years ago
Descriptionplain2015-11-09 10:14:44
% string is integer 2147483649
1
% expr {int(2147483649)}
-2147483647

% string is wide -9223372036854775809
1
% expr {wide(-9223372036854775809)}
9223372036854775807

Both those numbers do not fit in the respective 32/64 bit widths. Note that [string is] is supposed to check for range. For example,

% string is integer 21474836490
0

/Ashok
sebresplain2015-11-09 11:18:53
Agree. I believe the Tcl_GetWideIntFromObj works "wrong" in sense of "string is wideinteger" if the given object a bignum that can fit in a Tcl_WideInt, but it occurs sign independent!

So either inside StringIsCmd after executing of Tcl_GetWideIntFromObj it should check a sign of "original" bignum object.
Or we should change logic of Tcl_GetWideIntFromObj for bignum that can fit with invalid sign (I will prefer this, but it has serious impact).

I will increase a priority, because it can be an issue of Tcl_GetWideIntFromObj self (not a string issue only).
dgpplain2015-11-09 19:40:51
Not a bug.  See TIP 297.
jan.nijtmans Closed ticket [dd14ad7824]. [History diff]2015-12-01 12:43:52
dkf Ticket [dd14ad7824]: 5 changes [History diff]2016-08-23 13:46:54
Log in (anonymous is fine) to add a comment.