File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,14 @@ def value
138
138
matches = @value . scan ( PEREFERENCE_RE )
139
139
rv = @value . clone
140
140
if @parent
141
+ sum = 0
141
142
matches . each do |entity_reference |
142
143
entity_value = @parent . entity ( entity_reference [ 0 ] )
144
+ if sum + entity_value . bytesize > Document . entity_expansion_text_limit
145
+ raise "entity expansion has grown too large"
146
+ else
147
+ sum += entity_value . bytesize
148
+ end
143
149
rv . gsub! ( /%#{ entity_reference } ;/um , entity_value )
144
150
end
145
151
end
Original file line number Diff line number Diff line change @@ -138,8 +138,14 @@ def value
138
138
matches = @value . scan ( PEREFERENCE_RE )
139
139
rv = @value . clone
140
140
if @parent
141
+ sum = 0
141
142
matches . each do |entity_reference |
142
143
entity_value = @parent . entity ( entity_reference [ 0 ] )
144
+ if sum + entity_value . bytesize > Document . entity_expansion_text_limit
145
+ raise "entity expansion has grown too large"
146
+ else
147
+ sum += entity_value . bytesize
148
+ end
143
149
rv . gsub! ( /%#{ entity_reference . join } ;/um , entity_value )
144
150
end
145
151
end
Original file line number Diff line number Diff line change @@ -138,8 +138,14 @@ def value
138
138
matches = @value . scan ( PEREFERENCE_RE )
139
139
rv = @value . clone
140
140
if @parent
141
+ sum = 0
141
142
matches . each do |entity_reference |
142
143
entity_value = @parent . entity ( entity_reference [ 0 ] )
144
+ if sum + entity_value . bytesize > Document . entity_expansion_text_limit
145
+ raise "entity expansion has grown too large"
146
+ else
147
+ sum += entity_value . bytesize
148
+ end
143
149
rv . gsub! ( /%#{ entity_reference . join } ;/um , entity_value )
144
150
end
145
151
end
You can’t perform that action at this time.
0 commit comments