-
Notifications
You must be signed in to change notification settings - Fork 172
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
Memory corruption due to ellipsed text when using Pango #722
Comments
Using valgrind we managed to track this issue down to thread-unsafe usage of font caches. Pango is thread safe in this regard by keeping a font cache per thread. Libgdiplus however sends a global font cache to Pango resulting in use after free issues. This case can be fixed by replacing the usage of Here's an example of the valgrind output:
|
I think the custom font map is there to support user-loaded fonts. We would likely need to add locks around the Pango calls. |
Reproducible example: https://github.com/handerss-tibco/libgdiplus-pango-memory-corruption
There are memory corruption issues when performing
MeasureString
on multiple threads if measurement uses ellipsed text. This corruption error only occurs when libgdiplus is compiled with pango as the backend. Here's a minimal reproducible example:This program produces a number of warnings/criticals:
These issues are only observed when multiple threads are used, and when libgdiplus is compiled with pango backend. We also observe these issues when compiling libgdiplus from
main
and using a new version of Pango 1.46.2 (Debian 11).The text was updated successfully, but these errors were encountered: