arklumpus / VectSharp

A light library for C# vector graphics
GNU Lesser General Public License v3.0
226 stars 22 forks source link

Fix OutOfMemoryException #32

Closed fabianfoos closed 2 years ago

fabianfoos commented 2 years ago

Fix OutOfMemoryException when importing SVG with text with stroke-width=0 and then rasterize it with ImageSharp.

arklumpus commented 2 years ago

Hi, thank you for noticing this! I have investigated a bit, and I believe that this is actually a bug in ImageSharp (there is a call to an ImageSharp method that hangs and allocates large amounts of memory).

I have created a bug report there (SixLabors/ImageSharp.Drawing#224), and hopefully they will look into it.

In the meantime, the best way to implement a workaround in VectSharp would be within VectSharp.Raster.ImageSharp, rather than in VectSharp.SVG (you don't need an SVG file to reproduce the issue, even just stroking a rectangle with a line thickness of 0 will reproduce the bug).

I have a simple fix for this (as you can imagine, it's just a single line of code), however I have just started a new job, and I am still waiting to be formally authorised to release my code as open-source... Hopefully this won't take too long and I can release an updated version of VectSharp.Raster.ImageSharp soon.

fabianfoos commented 2 years ago

Hi, many thanks for reviewing the issue! Good luck with your new job! Best regards!

arklumpus commented 2 years ago

This should be fixed in VectSharp.Raster.ImageSharp 1.1.3-beta14.16!