TclFindElement permits buffer overrun
Closed / Fixed3192636fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2011-02-25 21:27:25
The TclFindElement() routine accepts a pair of arguments (CONST char *list) and (int listLength) which determine the string to be parsed. Examination of that string ought not continue beyond the byte (list + listLength) but if that point happens in the middle of a backslash escape sequence, nothing is done to prevent it. Looking for any ways to demo this via public access...
dgpplain2011-02-26 04:49:26
% testparser {{*}\u218} 8
- {{*}\u218} 1 expand {{*}\u218} 1 backslash {\u218} 0 {}
% testparser {{*}\u218} 7
- \{*\}\\u218\}¾r\n 1 expand \{*\}\\u218\}¾r 12 backslash {\u218} 0 text 0 text \} 0 text 0 text 0 text ¾ 0 text 0 text 0 text 0 text r 0 text 0 text 0 {}
dgpplain2011-03-05 14:38:58
That actually demos a different bug in TclParseBackslash.
dgpplain2011-03-06 11:36:57
see 3200987
dgpplain2011-03-07 00:53:50
OK, with that bug fixed, there's no way a script can run into this problem. We can declare it "not a bug" so long as we add a precondition for all callers of this private routine that *(list+listLength) == `\0` . Since most of the time, the string being parsed is the bytes field of a Tcl_Obj, this is usually easily satisfied.
dgpplain2011-03-07 02:53:13
Nah, it's too simple a fix not to fix it. The only real snag is no easy way to add a test.
dgpplain2011-03-07 03:07:44
allow_comments - 1 fixed in all open branches
Log in (anonymous is fine) to add a comment.