Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-08-07
21:48 • Ticket [2017583fff] unnecessary numLevels++ in tclParse.c? status still Clos... artifact: 7659549f98 user: dgp
21:43 • Closed ticket [2017583fff]. artifact: 7c6745f247 user: msofer
21:29 • Ticket [2017583fff]: 4 changes artifact: ef4970b170 user: dgp
21:22 • Pending ticket [2017583fff]. artifact: e983c30d07 user: dgp
2008-07-15
21:13 • Ticket [2017583fff]: 4 changes artifact: 72a0bd95d5 user: msofer
05:08 • Ticket [2017583fff]: 4 changes artifact: fda7e960b1 user: mistachkin
03:38 • Open ticket [2017583fff]. artifact: ac8d4441e1 user: msofer
03:31 • Closed ticket [2017583fff]. artifact: 269d415ef5 user: msofer
03:00 • Ticket [2017583fff]: 4 changes artifact: 77257a31af user: dgp
02:42 • Ticket [2017583fff]: 5 changes artifact: 5e3c938b1b user: dgp
2008-07-14
19:21 • Ticket [2017583fff]: 4 changes artifact: 2c40926d34 user: msofer
13:02 • Ticket [2017583fff]: 5 changes artifact: 8961ea1879 user: dgp
07:41 • Ticket [2017583fff]: 1 change artifact: b8069e6459 user: msofer
07:36 • Ticket [2017583fff]: 4 changes artifact: a9d0fa22b7 user: msofer
07:36 • Add attachment numlevels.patch to ticket [2017583fff] artifact: 655cffde72 user: msofer
00:36 • New ticket [2017583fff] unnecessary numLevels++ in tclParse.c?. artifact: d8bdae211e user: msofer

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: