You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the ruby/rss gem to parse XML feeds and we get RuntimeErrors “entity expansion has grown too large” since rexml 3.3.3 even though there is only default entities in the feeds.
❯ bundle exec ruby refactor_entity_example.rb
/Users/vikiv/repos/rexml/lib/rexml/parsers/baseparser.rb:558:in `block in unnormalize': entity expansion has grown too large (RuntimeError) from /Users/vikiv/repos/rexml/lib/rexml/parsers/baseparser.rb:551:in `each' from /Users/vikiv/repos/rexml/lib/rexml/parsers/baseparser.rb:551:in `unnormalize' from refactor_entity_example.rb:8:in `<main>'
Suggestion
I suggest we change #entity/#unnormalize to not raise the RuntimeError “entity expansion has grown too large” when the feed consists of only default entities.
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index 342f948..d560d3a 100644
--- a/lib/rexml/parsers/baseparser.rb+++ b/lib/rexml/parsers/baseparser.rb@@ -505,15 +505,13 @@ module REXML
private :pull_event
def entity( reference, entities )
- value = nil
value = entities[ reference ] if entities
if value
record_entity_expansion
- else- value = DEFAULT_ENTITIES[ reference ]- value = value[2] if value+ return unnormalize( value, entities ) if value
end
- unnormalize( value, entities ) if value++ nil
end
# Escapes all possible entities
The text was updated successfully, but these errors were encountered:
vikiv480
added a commit
to vikiv480/rexml
that referenced
this issue
Aug 14, 2024
Why?
We are using the ruby/rss gem to parse XML feeds and we get RuntimeErrors “entity expansion has grown too large” since rexml 3.3.3 even though there is only default entities in the feeds.
How to reproduce
Code:
Error:
Suggestion
I suggest we change
#entity
/#unnormalize
to not raise the RuntimeError “entity expansion has grown too large” when the feed consists of only default entities.The text was updated successfully, but these errors were encountered: