Tcl Source Code

Check-in [2ec58720e9]
Login

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

Overview
Comment:closes [35a8f1c04a]: minimalist fix - beware of discrepancy between TclScanElement and TclConvertElement (prefer braces considering TCL_DONT_QUOTE_HASH in case of first list element)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | bug-35a8f1c04a
Files: files | file ages | folders
SHA3-256: 2ec58720e930df0b0a2e382a49f025b0ac45bfb0db36355678eec71a90344d0b
User & Date: sebres 2018-11-09 14:19:08.040
References
2018-11-09
14:23 Closed ticket [35a8f1c04a]: List command can used to read beyond bounds of input plus 8 other changes artifact: 512d067150 user: sebres
Context
2018-11-09
15:39
Revise bug fix to support (length == 0) correctly. Added comments and improved safety in caller. check-in: 3b0bc7a6e1 user: dgp tags: bug-35a8f1c04a
14:19
closes [35a8f1c04a]: minimalist fix - beware of discrepancy between TclScanElement and TclConvertEle... check-in: 2ec58720e9 user: sebres tags: bug-35a8f1c04a
14:13
test case to cover bug [35a8f1c04a] check-in: d76fb9091b user: sebres tags: bug-35a8f1c04a
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclUtil.c.
940
941
942
943
944
945
946




947
948
949
950
951
952
953
				 * sequences in formatting. */
    int bytesNeeded;		/* Buffer length computed to complete the
				 * element formatting in the selected mode. */
#if COMPAT
    int preferEscape = 0;	/* Use preferences to track whether to use */
    int preferBrace = 0;	/* CONVERT_MASK mode. */
    int braceCount = 0;		/* Count of all braces '{' '}' seen. */




#endif

    if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == -1))) {
	/* Empty string element must be brace quoted. */
	*flagPtr = CONVERT_BRACE;
	return 2;
    }







>
>
>
>







940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
				 * sequences in formatting. */
    int bytesNeeded;		/* Buffer length computed to complete the
				 * element formatting in the selected mode. */
#if COMPAT
    int preferEscape = 0;	/* Use preferences to track whether to use */
    int preferBrace = 0;	/* CONVERT_MASK mode. */
    int braceCount = 0;		/* Count of all braces '{' '}' seen. */

    if ((*src == '#') && !(*flagPtr & TCL_DONT_QUOTE_HASH)) {
	preferBrace = 1;
    }
#endif

    if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == -1))) {
	/* Empty string element must be brace quoted. */
	*flagPtr = CONVERT_BRACE;
	return 2;
    }