From 9cdd297a2959c9c01eeee4a743b4777f28ffc9e4 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 27 Oct 2014 11:18:02 +0000 Subject: * lib/rexml/entity.rb: keep the entity size within the limitation. reported by Willis Vandevanter and patched by nahi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rexml/test_entity.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/rexml/test_entity.rb') diff --git a/test/rexml/test_entity.rb b/test/rexml/test_entity.rb index 820e4f2b85..7d16dc83fe 100644 --- a/test/rexml/test_entity.rb +++ b/test/rexml/test_entity.rb @@ -123,6 +123,22 @@ module REXMLTests end end + def test_entity_string_limit_for_parameter_entity + template = ' ]>' + 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 = ' -- cgit v1.2.3