• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7166: TOC variable has potential infinite recursion

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed   major 6.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

TWikibug:Item6864 expands variables when handling %TOC%, but this exposes potential infinite recursion possibility.
To reproduce it, just create two pages, "TestPage1" and "TestPage2". These two pages have exactly the same content as
%TOC{TestPage1}%
%TOC{TestPage2}%
---++ %TOPIC%
---++ %WEB%
Then neither "TestPage1" nor "TestPage2" can be opened until timeout.

I escape TOC variables before TOC handler expands variables again.
$ svn diff TWiki.pm
Index: TWiki.pm
===================================================================
--- TWiki.pm    (revision 25187)
+++ TWiki.pm    (working copy)
@@ -2599,7 +2599,8 @@
         }
         my $meta;
         ( $meta, $text ) = $this->{store}->readTopic( $this->{user}, $web, $topic );
-
+        # Item7166: Escape %TOC% to avoid infinite recursion.
+        $text =~ s/%(TOC[{%])/%<nop>$1/g;
         # Item6864: 2012-03-29 TWiki:Main.GertjanVanOosten, gertjan at west dot nl:
         #   Handle common tags, as the text may contain variables etc. that need
         #   to be expanded before generating the TOC for another topic.
         $text = $this->handleCommonTags( $text, $web, $topic, $meta );


-- TWiki:Main/YaojunFei - 2013-02-26

This is now fixed differently in Item7286. There was still an infinite loop possible if an INCLUDEd topic had a TOC.

-- TWiki:Main.PeterThoeny - 2013-06-28

ItemTemplate
Summary TOC variable has potential infinite recursion
ReportedBy TWiki:Main.YaojunFei
Codebase ~twiki4, 5.1.4, 5.1.3, 5.1.2
SVN Range TWiki-5.1.3-trunk, Wed, 20 Feb 2013, build 25123
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:25206 TWikirev:25211 TWikirev:25236
TargetRelease major
ReleasedIn 6.0.0
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r11 - 2013-10-15 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback