diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-27 11:24:04 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-27 11:24:04 +0000 |
commit | 10f820b18d8c6011a7f98e56ac859903c56b15e6 (patch) | |
tree | 6903c4a0b75866af7059b08351e9402cc13cbf9d /test/rexml/test_entity.rb | |
parent | 26c0acf5a77e122fb3f4a25b924bc3982dfb1408 (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_1_9_3@48164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_entity.rb')
-rw-r--r-- | test/rexml/test_entity.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/rexml/test_entity.rb b/test/rexml/test_entity.rb index 5900fac7a8..93c4c838f6 100644 --- a/test/rexml/test_entity.rb +++ b/test/rexml/test_entity.rb @@ -122,6 +122,22 @@ class EntityTester < Test::Unit::TestCase end end + def test_entity_string_limit_for_parameter_entity + template = '<!DOCTYPE bomb [ <!ENTITY % a "^" > <!ENTITY bomb "$" > ]><root/>' + len = 5120 # 5k per entity + template.sub!(/\^/, "B" * len) + + # 10k is OK + entities = '%a;' * 2 # 5k entity * 2 = 10k + REXML::Document.new(template.sub(/\$/, entities)) + + # above 10k explodes + entities = '%a;' * 3 # 5k entity * 2 = 15k + assert_raises(REXML::ParseException) do + REXML::Document.new(template.sub(/\$/, entities)) + end + end + def test_raw source = '<!DOCTYPE foo [ <!ENTITY ent "replace"> |