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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to generic/tclParse.c.

  1165   1165   	     * parse information.
  1166   1166   	     */
  1167   1167   
  1168   1168   	    src++;
  1169   1169   	    numBytes--;
  1170   1170   	    nestedPtr = TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse));
  1171   1171   	    while (1) {
         1172  +		const char *curEnd;
         1173  +		
  1172   1174   		if (Tcl_ParseCommand(parsePtr->interp, src, numBytes, 1,
  1173   1175   			nestedPtr) != TCL_OK) {
  1174   1176   		    parsePtr->errorType = nestedPtr->errorType;
  1175   1177   		    parsePtr->term = nestedPtr->term;
  1176   1178   		    parsePtr->incomplete = nestedPtr->incomplete;
  1177   1179   		    TclStackFree(parsePtr->interp, nestedPtr);
  1178   1180   		    return TCL_ERROR;
  1179   1181   		}
         1182  +		curEnd = src + numBytes;
  1180   1183   		src = nestedPtr->commandStart + nestedPtr->commandSize;
  1181         -		numBytes = parsePtr->end - src;
         1184  +		numBytes = curEnd - src;
  1182   1185   		Tcl_FreeParse(nestedPtr);
  1183   1186   
  1184   1187   		/*
  1185   1188   		 * Check for the closing ']' that ends the command
  1186   1189   		 * substitution. It must have been the last character of the
  1187   1190   		 * parsed command.
  1188   1191   		 */