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
I've ran into a parsing issue with some very long XML attributes. For example, the following will raise a RangeError: Maximum call stack size exceeded while running the Attribute regex:
parseXml(`<a b="${'a'.repeat(9000000)}"/>`);
I was able to avoid the error by slightly relaxing the attribute value parts of the Attribute regex as follows:
[^<&"] | ${exports.Reference} => [^<"]
but this change causes 4 tests to fail that are expecting exceptions from various bad & uses in attribute values.
Perhaps the regexes could be kept strict while avoiding the call stack exception, or perhaps a 2-phase approach could be used where the attribute value is checked for invalid references after being parsed from the overall tag.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this! I haven't investigated the problem or your proposed solution yet, but I'll try to take a look soon. This work will probably align well with the larger investigation I want to do (prompted by your earlier issue #9) into the possibility of relying less on regexes, or at least hardening them to be less fragile in cases like this.
I've ran into a parsing issue with some very long XML attributes. For example, the following will raise a
RangeError: Maximum call stack size exceeded
while running the Attribute regex:I was able to avoid the error by slightly relaxing the attribute value parts of the
Attribute
regex as follows:[^<&"] | ${exports.Reference}
=>[^<"]
but this change causes 4 tests to fail that are expecting exceptions from various bad
&
uses in attribute values.Perhaps the regexes could be kept strict while avoiding the call stack exception, or perhaps a 2-phase approach could be used where the attribute value is checked for invalid references after being parsed from the overall tag.
The text was updated successfully, but these errors were encountered: