thorvg icon indicating copy to clipboard operation
thorvg copied to clipboard

Write access violation, loading a SVG.

Open Jean-Amaro opened this issue 1 year ago • 4 comments

Hello, everyone! I'm really enjoying ThorVG. Unfortunately, I'm having a crash, when using the C API function tvg_picture_load on a SVG file. The crash happens when there is an accented latin character in a text element. The example below can be used to reproduce the crash:

parsed_text_bug

I am using the version 0.14.3 (x64 and x86), installed via vcpkg, being the code compiled on MSVC v14.28 (latest version from Microsoft Visual Studio 2019). Besides the aforementioned function, I also use the tvg_font_load to load the Arial font.

Jean-Amaro avatar Aug 15 '24 20:08 Jean-Amaro

The crash shouldn't occur in any case.

@Jean-Amaro Hello, could you please share the problematic SVG file so that we can reproduce the issue exactly same way? or you can send it to [email protected] Thanks.

hermet avatar Aug 16 '24 04:08 hermet

Sure! The SVG is:

<svg width="20px" height="20px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/">
    <text x="0.0px" y="20.0px" font-family="arial" font-size="16px">É</text>
</svg>

And the code is:

#include <stdlib.h>
#include <stdio.h>
#include <thorvg_capi.h>

int main() {
	printf("init: %d\n", (int)(tvg_engine_init(TVG_ENGINE_SW, 0)));

	Tvg_Paint *svg = tvg_picture_new();

	printf("font->load: %d\n", (int)(tvg_font_load("./arial.ttf")));
	printf("svg->load: %d\n", (int)(tvg_picture_load(svg, "parsed_text_bug.svg")));

	return 0;
}

Jean-Amaro avatar Aug 16 '24 19:08 Jean-Amaro

Every file is using the UTF-8 encoding.

Jean-Amaro avatar Aug 16 '24 19:08 Jean-Amaro

@Jean-Amaro Hi, composite glyphs were recently added to ThorVG. It seems the version in vcpkg is not up-to-date, so you might need to manually install ThorVG using the latest official release=> https://github.com/thorvg/thorvg/releases/tag/v0.14.6 Otherwise, you can wait for this progress: https://github.com/microsoft/vcpkg/pull/40511

hermet avatar Aug 17 '24 04:08 hermet