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