summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-27 11:22:04 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-27 11:22:04 +0000
commit61ff012d26bb77962dc7d7f7e04d73f8ae54c676 (patch)
tree207e8ba7286c8a2f25e4d62b8f3d86240e197228 /lib
parent2c31816f1abd48cadda2e91262e0b30913fe1694 (diff)
merge revision(s) 48161:
* lib/rexml/entity.rb: keep the entity size within the limitation. reported by Willis Vandevanter <will@silentrobots.com> and patched by nahi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@48162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rexml/entity.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rexml/entity.rb b/lib/rexml/entity.rb
index 3d81fbc738..dc3f666cad 100644
--- a/lib/rexml/entity.rb
+++ b/lib/rexml/entity.rb
@@ -138,8 +138,14 @@ module REXML
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
+ sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
+ if sum + entity_value.bytesize > Document.entity_expansion_text_limit
+ raise "entity expansion has grown too large"
+ else
+ sum += entity_value.bytesize
+ end
rv.gsub!( /%#{entity_reference.join};/um, entity_value )
end
end