Tcl Source Code

Check-in [f37dff89f9]
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:ParseTokens failed to fully respect its numBytes argument.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f37dff89f9b3009ee44e5c830135c3f0e1ac4a52
User & Date: dgp 2017-02-27 14:53:32
Context
2017-03-05
15:05
Fix for Ticket [71c0878b71] + test cases check-in: 154835dcb2 user: avl tags: trunk
11:04
Create new branch named "tip-465" check-in: 64cf6142f5 user: avl tags: tip-465
2017-02-28
10:03
TIP 312 implementation. Patch from RenĂ© Zaumseil. Eliminated compiler warnings and partially reform... check-in: bf3596331e user: jan.nijtmans tags: tip-312
2017-02-27
15:33
merge trunk check-in: 8f3c0f8bbf user: dgp tags: tip-445
15:19
merge trunk check-in: 5fb0e5ebc8 user: dgp tags: bg-tip-282
15:09
merge trunk check-in: 2373c7579f user: dgp tags: novem
14:53
ParseTokens failed to fully respect its numBytes argument. check-in: f37dff89f9 user: dgp tags: trunk
14:52
ParseTokens failed to fully respect its numBytes argument. check-in: 164d2be2c4 user: dgp tags: core-8-6-branch
2017-02-26
15:33
[25842c161f] Ensure that finalization of a zlib stream works. check-in: 6b926caddb user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to generic/tclParse.c.

1165
1166
1167
1168
1169
1170
1171


1172
1173
1174
1175
1176
1177
1178
1179

1180
1181
1182
1183
1184
1185
1186
1187
1188
	     * parse information.
	     */

	    src++;
	    numBytes--;
	    nestedPtr = TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse));
	    while (1) {


		if (Tcl_ParseCommand(parsePtr->interp, src, numBytes, 1,
			nestedPtr) != TCL_OK) {
		    parsePtr->errorType = nestedPtr->errorType;
		    parsePtr->term = nestedPtr->term;
		    parsePtr->incomplete = nestedPtr->incomplete;
		    TclStackFree(parsePtr->interp, nestedPtr);
		    return TCL_ERROR;
		}

		src = nestedPtr->commandStart + nestedPtr->commandSize;
		numBytes = parsePtr->end - src;
		Tcl_FreeParse(nestedPtr);

		/*
		 * Check for the closing ']' that ends the command
		 * substitution. It must have been the last character of the
		 * parsed command.
		 */






>
>








>

|







1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
	     * parse information.
	     */

	    src++;
	    numBytes--;
	    nestedPtr = TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse));
	    while (1) {
		const char *curEnd;
		
		if (Tcl_ParseCommand(parsePtr->interp, src, numBytes, 1,
			nestedPtr) != TCL_OK) {
		    parsePtr->errorType = nestedPtr->errorType;
		    parsePtr->term = nestedPtr->term;
		    parsePtr->incomplete = nestedPtr->incomplete;
		    TclStackFree(parsePtr->interp, nestedPtr);
		    return TCL_ERROR;
		}
		curEnd = src + numBytes;
		src = nestedPtr->commandStart + nestedPtr->commandSize;
		numBytes = curEnd - src;
		Tcl_FreeParse(nestedPtr);

		/*
		 * Check for the closing ']' that ends the command
		 * substitution. It must have been the last character of the
		 * parsed command.
		 */