weisJ/jsvg

SVG failing to render with 1.1.0, out of memory

Closed this issue · 2 comments

This SVG does not render with 1.1.0 due to an out-of-memory error, but it does render with 1.0.0.

car

Heap-sizes aside, the core issue seems to be a radial gradient radialGradient3595 based on the linear gradient linearGradient3589, which is then applied to path3579.

The issue stems from the two stops at 0 in the gradient. One is replaced with Math.nextAfter(...) in AbstractGradient:112, giving it a value along the lines of 1.4E-45.

In SVGMultipleGradientPaintContext, lines 275-286, this seems to cause the estimatedSize to overflow. It seems therefore the estimatedSize > MAX_GRADIENT_ARRAY_SIZE check fails, and in calculateSingleArrayGradient:344 it tries creating a massive array, causing the error.

weisJ commented

Thank you for reporting this (and digging into the issue)!

weisJ commented

The fix is included in version 1.2.0