Skip to content
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

"Large" SVG files can crash build #3785

Closed
Xaldew opened this issue Aug 17, 2024 · 0 comments · Fixed by #3787
Closed

"Large" SVG files can crash build #3785

Xaldew opened this issue Aug 17, 2024 · 0 comments · Fixed by #3787
Assignees

Comments

@Xaldew
Copy link

Xaldew commented Aug 17, 2024

Environment

Python Version:
Python 3.10.12

Nikola Version:
Nikola v8.3.1

Operating System:
Ubuntu Jammy 22.04

Description:

I'm currently working on adding some SVG images to my blog, but ran into a bit of an issue with the image processing:

nikola build
Scanning posts...........done!
.  scale_images:output/images/publications/succinct-opacity-micromaps/compression-teaser.opt.svg
TaskError - taskid:scale_images:output/images/publications/succinct-opacity-micromaps/compression-teaser.opt.svg
PythonAction Error
Traceback (most recent call last):
  File "/home/xaldew/git/homepage/venv/lib/python3.10/site-packages/doit/action.py", line 461, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/home/xaldew/git/homepage/venv/lib/python3.10/site-packages/nikola/plugins/task/scale_images.py", line 69, in process_image
    self.resize_image(
  File "/home/xaldew/git/homepage/venv/lib/python3.10/site-packages/nikola/image_processing.py", line 107, in resize_image
    self.resize_svg(src, dst_paths, max_sizes, bigger_panoramas)
  File "/home/xaldew/git/homepage/venv/lib/python3.10/site-packages/nikola/image_processing.py", line 184, in resize_svg
    tree = lxml.etree.XML(xml)
  File "src/lxml/etree.pyx", line 3285, in lxml.etree.XML
  File "src/lxml/parser.pxi", line 1995, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1882, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1164, in lxml.etree._BaseParser._parseDoc
  File "src/lxml/parser.pxi", line 633, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 743, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 672, in lxml.etree._raiseParseError
  File "<string>", line 42
lxml.etree.XMLSyntaxError: Memory allocation failed : Huge input lookup, line 42, column 10000034

########################################
scale_images:output/images/publications/succinct-opacity-micromaps/compression-teaser.opt.svg <stdout>:

Admittedly, the image is kind of large (~50MB), I assume from having several embedded 1920x1080 PNGs (Base-64 encoded, I think). However, I would argue that it's not really large enough to warrant this failure, and probably should have some kind of fallback to handle large SVGs anyways. Perhaps it should simply issue a warning and just copy the SVG when something like the above happen?

The image in question is linked here, since it's too big to include on GitHub:
https://gustafwaldemarson.com/misc/compression-teaser.opt.svg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants