Ticket UUID: | 2017583 | |||
Title: | unnecessary numLevels++ in tclParse.c? | |||
Type: | Bug | Version: | None | |
Submitter: | msofer | Created on: | 2008-07-14 00:36:13 | |
Subsystem: | 45. Parsing and Eval | Assigned To: | msofer | |
Priority: | 4 | Severity: | ||
Status: | Closed | Last Modified: | 2008-08-07 21:48:17 | |
Resolution: | Invalid | Closed By: | msofer | |
Closed on: | 2008-08-07 14:43:50 | |||
Description: |
I have committed the attached patch that eliminates an unnecessary (I think!) numLevels++ in TclSubstTokens. Note that there is a call to TclEvalEx, which in turn calls Tcl_EvalObjv, which does the numLevel management. If I'm wrong ... please revert. | |||
User Comments: |
dgp added on 2008-08-07 21:48:17:
Logged In: YES user_id=80530 Originator: NO no, they count levels of recursion in substitution, before command procedure invocation is reached. msofer added on 2008-08-07 21:43:50: Logged In: YES user_id=148712 Originator: YES Understood: these count parser recursion levels, not evaluation recursion levels. dgp added on 2008-08-07 21:29:01: Logged In: YES user_id=80530 Originator: NO Add proc {} args {} to that last demo script to avoid issues irrelevant to the subject. dgp added on 2008-08-07 21:22:13: Logged In: YES user_id=80530 Originator: NO If this management of numLevels is removed, the following test script will no longer work correctly: interp recursionlimit {} 100 testevalex [string repeat \[ 200][string repeat \] 200] The limit won't catch the evaluation. The implication is that an arbitrary number of nested calls to TclEvalEx can happen on the C stack without any protection. Unless things change even more under the hood, we still need those lines managing numLevels in TclSubstTokens. msofer added on 2008-07-15 21:13:26: Logged In: YES user_id=148712 Originator: YES Ooops ... now I did, thx. mistachkin added on 2008-07-15 05:08:11: Logged In: YES user_id=113501 Originator: NO Did you restore the call to TclResetCancellation? msofer added on 2008-07-15 03:38:15: Logged In: YES user_id=148712 Originator: YES Keeping open for review at leisure msofer added on 2008-07-15 03:31:16: Logged In: YES user_id=148712 Originator: YES Patch reverted. dgp added on 2008-07-15 03:00:51: Logged In: YES user_id=80530 Originator: NO hmmm, they're passing, but only because they've been revised. dgp added on 2008-07-15 02:42:41: Logged In: YES user_id=80530 Originator: NO Revision 1.40 of tclParse.c was the first to acquire those numLevel manipulations, allegedly to fix Bug 1115904. Tests parse-19.[1-4] were added to test the fix, so if they're still passing, things should be ok. msofer added on 2008-07-14 19:21:09: Logged In: YES user_id=148712 Originator: YES Remark that this is related to "Kill TEOVi" (outdated Patch #1904111). All evals now go through TEOV, which manages the numLevel. Before this change direct callers of TEOVi (bypassing TEOV) had to manage the numLevel. dgp added on 2008-07-14 13:02:11: Logged In: YES user_id=80530 Originator: NO need a cvs history check for when the code was added, and what bug, if any, it was fixing at the time. msofer added on 2008-07-14 07:36:13: File Added - 284571: numlevels.patch |
Attachments:
- numlevels.patch [download] added by msofer on 2008-07-14 07:36:13. [details]