unnecessary numLevels++ in tclParse.c?
Closed / Invalid2017583fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-07-14 00:36:13
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.
msoferplain2008-07-14 07:36:13
File Added - 284571: numlevels.patch
msofer Ticket [2017583fff]: 1 change
[History diff]2008-07-14 07:41:15
dgpplain2008-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.
msoferplain2008-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.
dgpplain2008-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.
dgpplain2008-07-15 03:00:51
Logged In: YES user_id=80530 Originator: NO hmmm, they're passing, but only because they've been revised.
msoferplain2008-07-15 03:31:16
Logged In: YES user_id=148712 Originator: YES Patch reverted.
msoferplain2008-07-15 03:38:15
Logged In: YES user_id=148712 Originator: YES Keeping open for review at leisure
mistachkinplain2008-07-15 05:08:11
Logged In: YES user_id=113501 Originator: NO Did you restore the call to TclResetCancellation?
msoferplain2008-07-15 21:13:26
Logged In: YES user_id=148712 Originator: YES Ooops ... now I did, thx.
dgpplain2008-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.
dgpplain2008-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.
msoferplain2008-08-07 21:43:50
Logged In: YES user_id=148712 Originator: YES Understood: these count parser recursion levels, not evaluation recursion levels.
dgpplain2008-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.
Log in (anonymous is fine) to add a comment.
Attachments:
- numlevels.patch [download] added by msofer on 2008-07-14 07:36:13. [details]