Tcl Source Code

Check-in [8c34e3aa19]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge 8.7
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8c34e3aa1988c106ebc5bb8e7e3bea089d6322c3afe9c319bbdf94ad2e7d5eb8
User & Date: dgp 2018-04-05 17:59:28
Context
2018-04-15
23:06
Fix [9f3c253df5]: Tcl build broken on Win. Re-introduce TCL... check-in: edde576b1b user: jan.nijtmans tags: trunk
22:01
Merge trunk check-in: ee95a2c1be user: jan.nijtmans tags: memory-API
2018-04-12
01:58
Fix documentation typo check-in: 84e7fbfdee user: andy tags: trunk
2018-04-08
13:38
bugfix: clock scan accepted but ignored prefixes of options check-in: c41ad33cb4 user: avl42 tags: avl-fix-clock-scan-option-prefixes
2018-04-05
17:59
merge trunk check-in: e45bb42625 user: dgp tags: novem
17:59
merge 8.7 check-in: 8c34e3aa19 user: dgp tags: trunk
17:22
Plug memleak in [format] applied to bignums. check-in: 225c752bdc user: dgp tags: core-8-branch
15:38
merge 8.7 check-in: 68c23a4642 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclScan.c.

937
938
939
940
941
942
943
944


945










946
947
948

949
950
951
952
953
954
955
		    Tcl_SetStringObj(objPtr, buf, -1);
		} else {
		    TclSetIntObj(objPtr, wideValue);
		}
	    } else if (flags & SCAN_BIG) {
		if (flags & SCAN_UNSIGNED) {
		    mp_int big;
		    if ((Tcl_GetBignumFromObj(interp, objPtr, &big) != TCL_OK)


			    || mp_isneg(&big)) {










			Tcl_SetObjResult(interp, Tcl_NewStringObj(
				"unsigned bignum scans are invalid", -1));
			Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL);

			return TCL_ERROR;
		    }
		}
	    } else {
		if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) {
		    if (TclGetString(objPtr)[0] == '-') {
			value = LONG_MIN;






|
>
>
|
>
>
>
>
>
>
>
>
>
>


|
>







937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
		    Tcl_SetStringObj(objPtr, buf, -1);
		} else {
		    TclSetIntObj(objPtr, wideValue);
		}
	    } else if (flags & SCAN_BIG) {
		if (flags & SCAN_UNSIGNED) {
		    mp_int big;
		    int code = Tcl_GetBignumFromObj(interp, objPtr, &big);

		    if (code == TCL_OK) {
			if (mp_isneg(&big)) {
			    code = TCL_ERROR;
			}
			mp_clear(&big);
		    }

		    if (code == TCL_ERROR) {
			if (objs != NULL) {
			    ckfree(objs);
			}
			Tcl_DecrRefCount(objPtr);
			Tcl_SetObjResult(interp, Tcl_NewStringObj(
				"unsigned bignum scans are invalid", -1));
			Tcl_SetErrorCode(interp, "TCL", "FORMAT",
				"BADUNSIGNED",NULL);
			return TCL_ERROR;
		    }
		}
	    } else {
		if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) {
		    if (TclGetString(objPtr)[0] == '-') {
			value = LONG_MIN;

Changes to generic/tclStringObj.c.

1942
1943
1944
1945
1946
1947
1948

1949
1950
1951
1952
1953
1954
1955
		    goto error;
		}
		cmpResult = mp_cmp_d(&big, 0);
		isNegative = (cmpResult == MP_LT);
		if (cmpResult == MP_EQ) gotHash = 0;
		if (ch == 'u') {
		    if (isNegative) {

			msg = "unsigned bignum format is invalid";
			errCode = "BADUNSIGNED";
			goto errorMsg;
		    } else {
			ch = 'd';
		    }
		}






>







1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
		    goto error;
		}
		cmpResult = mp_cmp_d(&big, 0);
		isNegative = (cmpResult == MP_LT);
		if (cmpResult == MP_EQ) gotHash = 0;
		if (ch == 'u') {
		    if (isNegative) {
			mp_clear(&big);
			msg = "unsigned bignum format is invalid";
			errCode = "BADUNSIGNED";
			goto errorMsg;
		    } else {
			ch = 'd';
		    }
		}