-
-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] 1.11.4 - New libxml2 recursion limit breaks parsing for complex files #2257
Comments
👋 Hi, @yedennek, thanks for opening this issue. Sorry you're having this problem! Let me take a look. |
I've reproduced what you're seeing, and I've confirmed via git-bisect that this limit was introduced in https://gitlab.gnome.org/GNOME/libxml2/-/commit/6f1470a5d6e3e369fe93f52d5760ba7c947f0cd1 |
Nick, one of the libxml2 maintainers, has already made a fix upstream in how stack depth was being calculated! https://gitlab.gnome.org/GNOME/libxml2/-/commit/3e1aad4fe584747fd7d17cc7b2863a78e2d21a77 I'll apply this downstream in Nokogiri and cut a release for you. |
Assuming CI goes green shortly on the v1.11.x branch (https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri-v1.11.x), I'll cut a release tonight. |
That's amazing, thank you so much for the quick response! 🙏🏻 |
In the latest Nokogiri update to 1.11.4, the containing libxml2 library has been updated to set a hard-coded recursion limit. (See commit 6f1470a5 of that project).
On our end, we have to parse government-supplied files for tax specifications which are, admittedly, very large and complicated and we're not allowed to modify them.
Unfortunately the latest update means we can no longer parse these files and hit an
XPath error : Recursion limit exceeded
error when we call the following to read the linkedCT-2014-v1-95.xslt
.Nokogiri::XSLT(File.read(SCHEMA_DIR.join(xsl_filename)))
In our tests this is manifesting in a test failure parsing line 7669 of the
CT-2014-v1-95.xslt
file:compilation error: element when xsl:when : could not compile test expression
Expected behavior
Ideally, we'd like to be able to parse the horribly complicated file, but it would be incredibly useful to be able to have an override setting for the maximum recursion limit in order to override the default.
Environment
Additional context
We think we might be able to fix this temporarily on our end with a patch on a forked version of Nokogiri (which we're still testing) but we'd rather not do this permanently, and were wondering whether it would be possible to get some customisable limit for Nokogiri?
Proposed patch:
To note, I’ve also raised this with libxml2 in this issue here.
-->
The text was updated successfully, but these errors were encountered: