ruby-changes:27458
From: kou <ko1@a...>
Date: Tue, 26 Feb 2013 23:38:44 +0900 (JST)
Subject: [ruby-changes:27458] kou:r39510 (trunk): * lib/rexml/document.rb: move entity_expansion_limit accessor to ...
kou 2013-02-26 23:34:01 +0900 (Tue, 26 Feb 2013) New Revision: 39510 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39510 Log: * lib/rexml/document.rb: move entity_expansion_limit accessor to ... * lib/rexml/rexml.rb: ... here for consistency. * lib/rexml/document.rb (REXML::Document.entity_expansion_limit): deprecated. * lib/rexml/document.rb (REXML::Document.entity_expansion_limit=): deprecated. Modified files: trunk/ChangeLog trunk/lib/rexml/document.rb trunk/lib/rexml/rexml.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 39509) +++ ChangeLog (revision 39510) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Feb 26 23:32:44 2013 Kouhei Sutou <kou@c...> + + * lib/rexml/document.rb: move entity_expansion_limit accessor to ... + * lib/rexml/rexml.rb: ... here for consistency. + * lib/rexml/document.rb (REXML::Document.entity_expansion_limit): + deprecated. + * lib/rexml/document.rb (REXML::Document.entity_expansion_limit=): + deprecated. + Tue Feb 26 23:26:13 2013 Kouhei Sutou <kou@c...> * lib/rexml/document.rb: move entity_expansion_limit accessor to ... Index: lib/rexml/document.rb =================================================================== --- lib/rexml/document.rb (revision 39509) +++ lib/rexml/document.rb (revision 39510) @@ -243,16 +243,18 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/document.rb#L243 Parsers::StreamParser.new( source, listener ).parse end - @@entity_expansion_limit = 10_000 - # Set the entity expansion limit. By default the limit is set to 10000. + # + # Deprecated. Use REXML.entity_expansion_limit= instead. def Document::entity_expansion_limit=( val ) - @@entity_expansion_limit = val + REXML.entity_expansion_limit = val end # Get the entity expansion limit. By default the limit is set to 10000. + # + # Deprecated. Use REXML.entity_expansion_limit= instead. def Document::entity_expansion_limit - return @@entity_expansion_limit + return REXML.entity_expansion_limit end # Set the entity expansion limit. By default the limit is set to 10240. @@ -273,7 +275,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/document.rb#L275 def record_entity_expansion @entity_expansion_count += 1 - if @entity_expansion_count > @@entity_expansion_limit + if @entity_expansion_count > REXML.entity_expansion_limit raise "number of entity expansions exceeded, processing aborted." end end Index: lib/rexml/rexml.rb =================================================================== --- lib/rexml/rexml.rb (revision 39509) +++ lib/rexml/rexml.rb (revision 39510) @@ -29,6 +29,18 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/rexml.rb#L29 Copyright = COPYRIGHT Version = VERSION + @@entity_expansion_limit = 10_000 + + # Set the entity expansion limit. By default the limit is set to 10000. + def self.entity_expansion_limit=( val ) + @@entity_expansion_limit = val + end + + # Get the entity expansion limit. By default the limit is set to 10000. + def self.entity_expansion_limit + return @@entity_expansion_limit + end + @@entity_expansion_text_limit = 10_240 # Set the entity expansion limit. By default the limit is set to 10240. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/