Skip to content
Permalink
Browse files
Update 1.8.7 rexml to latest.
  • Loading branch information
headius committed Oct 28, 2014
1 parent 57ecaf6 commit 566b9d6ec23201403eaeae7d80f132e3dc2cb19b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
@@ -213,16 +213,18 @@ def Document::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.
#
# Deprecated. Use REXML.entity_expansion_text_limit= instead.
def Document::entity_expansion_text_limit=( val )
@@entity_expansion_text_limit = val
REXML.entity_expansion_text_limit = val
end

# Get the entity expansion limit. By default the limit is set to 10000.
#
# Deprecated. Use REXML.entity_expansion_text_limit instead.
def Document::entity_expansion_text_limit
return @@entity_expansion_text_limit
return REXML.entity_expansion_text_limit
end

attr_reader :entity_expansion_count
@@ -29,4 +29,16 @@ module REXML

Copyright = COPYRIGHT
Version = VERSION

@@entity_expansion_text_limit = 10_240

# Set the entity expansion limit. By default the limit is set to 10240.
def self.entity_expansion_text_limit=( val )
@@entity_expansion_text_limit = val
end

# Get the entity expansion limit. By default the limit is set to 10240.
def self.entity_expansion_text_limit
return @@entity_expansion_text_limit
end
end
@@ -1,3 +1,4 @@
require 'rexml/rexml'
require 'rexml/entity'
require 'rexml/doctype'
require 'rexml/child'
@@ -311,7 +312,7 @@ def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil )
sum = 0
string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) {
s = Text.expand($&, doctype, filter)
if sum + s.bytesize > Document.entity_expansion_text_limit
if sum + s.bytesize > REXML.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += s.bytesize
@@ -338,6 +339,5 @@ def Text.expand(ref, doctype, filter)
entity_value ? entity_value.value : ref
end
end

end
end

0 comments on commit 566b9d6

Please sign in to comment.