[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
Verification done on resolute (amd64) with libfreetype6 2.14.2+dfsg-1ubuntu0.3 from resolute-proposed. Environment: fresh ubuntu:resolute container (Ubuntu 26.04.1 LTS, image sha256:6a06111c3b0a8600feadb270aec771dc239bf407b25625f93f44ab00e11f4d3c), -proposed enabled with Pin-Priority 400 as per wiki.ubuntu.com/Testing/EnableProposed, and only libfreetype6 upgraded from -proposed. Ran the test plan from the bug description: Before, libfreetype6 2.14.2+dfsg-1ubuntu0.2 (resolute-updates/security): exit code: 1 ==383==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4100 byte(s) in 19 object(s) allocated from: #5 ... in FT_Glyph_To_Bitmap (/usr/lib/x86_64-linux-gnu/libfreetype.so.6+0x22009) SUMMARY: AddressSanitizer: 4100 byte(s) leaked in 19 allocation(s). Output of apt-cache policy libfreetype6: libfreetype6: Installed: 2.14.2+dfsg-1ubuntu0.3 Candidate: 2.14.2+dfsg-1ubuntu0.3 Version table: *** 2.14.2+dfsg-1ubuntu0.3 400 400 http://archive.ubuntu.com/ubuntu resolute-proposed/main amd64 Packages 100 /var/lib/dpkg/status 2.14.2+dfsg-1ubuntu0.2 500 500 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu resolute-security/main amd64 Packages 2.14.2+dfsg-1 500 500 http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages After, libfreetype6 2.14.2+dfsg-1ubuntu0.3 (resolute-proposed): exit code: 0 no LeakSanitizer output apt-cache policy libfreetype6 libfreetype6: Installed: 2.14.2+dfsg-1ubuntu0.3 Candidate: 2.14.2+dfsg-1ubuntu0.3 Version table: *** 2.14.2+dfsg-1ubuntu0.3 400 400 http://archive.ubuntu.com/ubuntu resolute-proposed/main amd64 Packages 100 /var/lib/dpkg/status 2.14.2+dfsg-1ubuntu0.2 500 500 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu resolute-security/main amd64 Packages 2.14.2+dfsg-1 500 500 http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages ** Tags added: verification-done-resolute ** Tags removed: verification-needed-resolute -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
Hello Aaron, or anyone else affected, Accepted freetype into resolute-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/freetype/2.14.2+dfsg-1ubuntu0.3 in a few hours, and then in the -proposed repository. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed- resolute to verification-done-resolute. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-resolute. In either case, without details of your testing we will not be able to proceed. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping! N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days. ** Changed in: freetype (Ubuntu Resolute) Status: In Progress => Fix Committed ** Tags added: verification-needed-resolute -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
** Changed in: freetype (Ubuntu Resolute) Status: New => In Progress -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
** Merge proposal linked: https://code.launchpad.net/~finnrg/ubuntu/+source/freetype/+git/freetype/+merge/513966 ** Also affects: freetype (Ubuntu Resolute) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
** Description changed: + [ Impact ] + + * freetype leaks memory when applications converts glyphs to bitmaps + using FT_Glyph_To_Bitmap + + [ Test Plan ] + + * sudo apt-get install libasan8 graphicsmagick fonts-dejavu-core + + * testdir=$(mktemp -d) + + * LD_PRELOAD=libasan.so.8 \ + ASAN_OPTIONS=detect_leaks=1:exitcode=1 \ + gm convert -size 400x100 xc:white \ + -font /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf \ + -pointsize 24 \ + -draw "text 10,50 'Hello ASAN 1234567890'" \ + "$testdir/tmp.png" + + * The above command should return with exit code 0 + + [ Where problems could occur ] + + * The change is isolated to FT_Glyph_To_Bitmap, if the patch is + incorrect this could result in incorrect glyph conversions, or if + ownership is transferred incorrectly applications could encounter + invalid memory accesses, double frees and similar. + + [ Other Info ] + + * The patch was taken directly from upstream which included the patch + in the now released version 2.14.3 used in stonking. + + --- + + freetype introduced a memory leak in 85c8efe0 (2026-02-07), included in 2.14.2, fixed in e7d2cc64 (2026-03-09) as a 3 line change. Reported upstream as #1399 and independently by OSS-Fuzz. You can reproduce the error using GraphicsMagick: apt-get install -y --no-install-recommends libasan8 graphicsmagick fonts-dejavu-core LD_PRELOAD=libasan.so.8 ASAN_OPTIONS=detect_leaks=1:exitcode=0 \ gm convert -size 400x100 xc:white \ -font /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf \ -pointsize 24 -draw "text 10,50 'Hello ASAN 1234567890'" /tmp/gm.png Expected (fixed): no LeakSanitizer output. Actual (libfreetype6 2.14.2+dfsg-1ubuntu0.1): = ==3548==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4100 byte(s) in 19 object(s) allocated from: #0 0x7a1f0830a60f in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:67 #1 0x7a1f07391657 (/usr/lib/x86_64-linux-gnu/libfreetype.so.6+0x12657) (BuildId: 06b00383961c2dbc8aaf7d0e70abe39fcc70eb8f) #2 0x7a1f073959f4 (/usr/lib/x86_64-linux-gnu/libfreetype.so.6+0x169f4) (BuildId: 06b00383961c2dbc8aaf7d0e70abe39fcc70eb8f) #3 0x7a1f073ff5fb (/usr/lib/x86_64-linux-gnu/libfreetype.so.6+0x805fb) (BuildId: 06b00383961c2dbc8aaf7d0e70abe39fcc70eb8f) #4 0x7a1f0739442a (/usr/lib/x86_64-linux-gnu/libfreetype.so.6+0x1542a) (BuildId: 06b00383961c2dbc8aaf7d0e70abe39fcc70eb8f) #5 0x7a1f073a1009 in FT_Glyph_To_Bitmap (/usr/lib/x86_64-linux-gnu/libfreetype.so.6+0x22009) (BuildId: 06b00383961c2dbc8aaf7d0e70abe39fcc70eb8f) #6 0x7a1f07ee9479 (/lib/libGraphicsMagick-Q16.so.3+0x3a479) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #7 0x7a1f07eec01b in AnnotateImage (/lib/libGraphicsMagick-Q16.so.3+0x3d01b) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #8 0x7a1f07fb4e92 (/lib/libGraphicsMagick-Q16.so.3+0x105e92) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #9 0x7a1f07fab7af in DrawImage (/lib/libGraphicsMagick-Q16.so.3+0xfc7af) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #10 0x7a1f07f1902a in MogrifyImage (/lib/libGraphicsMagick-Q16.so.3+0x6a02a) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #11 0x7a1f07f1d36e in MogrifyImages (/lib/libGraphicsMagick-Q16.so.3+0x6e36e) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #12 0x7a1f07f0ea83 in ConvertImageCommand (/lib/libGraphicsMagick-Q16.so.3+0x5fa83) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #13 0x7a1f07f154c7 in MagickCommand (/lib/libGraphicsMagick-Q16.so.3+0x664c7) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #14 0x7a1f07f2d775 (/lib/libGraphicsMagick-Q16.so.3+0x7e775) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #15 0x7a1f07f2d8c2 in GMCommand (/lib/libGraphicsMagick-Q16.so.3+0x7e8c2) (BuildId: ece43e2887d5d51362c21be6a7299e41992d0d62) #16 0x7a1f07cb8600 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a600) (BuildId: 240c8909736b31f963346aca80667fd00c551e32) #17 0x7a1f07cb8717 in __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a717) (BuildId: 240c8909736b31f963346aca80667fd00c551e32) #18 0x5b9ef1109094 (/usr/bin/gm+0x1094) (BuildId: 1de1cd53831c52408bcb83abb993b253a6bcc457) SUMMARY: AddressSanitizer: 4100 byte(s) leaked in 19 allocation(s). The fix should not affect the ABI. The patch applies cleanly on top of Ubuntu's full patch series (enable-gxvalid-otvalid, ftoption, no-web- fonts, hide-donations-information, CVE-2026-50811-1, CVE-2026-50811-2) with no fuzz or offset. Links: Upstream bug 1399 - https://gitlab.freedesktop.org/freetype/freetype/-/issues/1399 Fix - https://gitlab.freedesktop.org/freetype/freetype/-/commit/e7d2cc6466d048b54aed94012e3ff3bf57e08c53 diff -
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
This severe bug is severely hindering my ability to develop GraphicsMagick under Ubuntu because it causes 36 test failures when compiled with ASAN (or under Valgrind's memcheck) while running the GraphicsMagick test suite. When compiling using Clang and ASAN the test suite takes a very long time to run since it seems to take a minute to produce each backtrace (GCC's backtrace is instant). FreeType 2 is heavily used given that it is how text shown on the screen is rendered. This means that a lot of memory is being leaked. It is not clear if an Ubuntu maintainer has even looked at this bug report yet. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
Werner Lemberg fixed this bug in FreeType git already. He makes reference to a small change to FreeType code which solves it. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
Besides impacting GraphicsMagick (I am the GraphicsMagick developer), this bug impacts ImageMagick as well, and to a far greater degree. The leak is multiplied by the number of characters which are rendered. Google AI claims that leaks in FT_Glyph_To_Bitmap() are virtually impossible and that they are almost always due to user code issues with glyph memory management. This might cause someone to think that this bug report is insignificant due to a likely usage error. However, I spent much of a day investigating the issue and there is nothing wrong with how the function is used. A sample ImageMagick command to expose the problem is: magick -size 70x50 xc:white -draw 'text 10,30 "HH"' null: and the quantity of leakage is determined by how many "H" characters are included in the string. If this is impacting GUI applications, then this could cause quite a lot of memory to be lost in the system. This is what I see happening with ImageMagick: % valgrind --tool=memcheck --leak-check=full --error-exitcode=2 --track- origins=yes --num-callers=12 --quiet magick -size 70x50 xc:white -draw 'text 10,30 "HH"' null: ==755795== 128 bytes in 2 blocks are definitely lost in loss record 13 of 24 ==755795==at 0x4850858: malloc (vg_replace_malloc.c:447) ==755795==by 0x59A1657: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59A59F4: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x5A0F5FB: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59A442A: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59B1009: FT_Glyph_To_Bitmap (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x48F5F97: RenderFreetype (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F68B7: RenderType (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F6DC6: GetTypeMetrics (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x4984886: RenderMVGContent (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x49885F2: DrawImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x4E9A25F: CLISimpleOperatorImage.isra.0 (in /usr/local/lib/libMagickWand-7.Q16HDRI.so.10.0.3) ==755795== ==755795== 128 bytes in 2 blocks are definitely lost in loss record 14 of 24 ==755795==at 0x4850858: malloc (vg_replace_malloc.c:447) ==755795==by 0x59A1657: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59A59F4: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x5A0F5FB: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59A442A: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59B1009: FT_Glyph_To_Bitmap (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x48F5F97: RenderFreetype (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F68B7: RenderType (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F6DC6: GetTypeMetrics (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F71BB: AnnotateImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x497F2AC: DrawPrimitive (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x498257B: RenderMVGContent (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== ==755795== 128 bytes in 2 blocks are definitely lost in loss record 15 of 24 ==755795==at 0x4850858: malloc (vg_replace_malloc.c:447) ==755795==by 0x59A1657: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59A59F4: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x5A0F5FB: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59A442A: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x59B1009: FT_Glyph_To_Bitmap (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795==by 0x48F5F97: RenderFreetype (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F68B7: RenderType (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x48F76EC: AnnotateImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x497F2AC: DrawPrimitive (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x498257B: RenderMVGContent (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795==by 0x49885F2: DrawImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions --
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: freetype (Ubuntu) Status: New => Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 2166358] Re: Memory leak in libfreetype6 2.14.2
** Changed in: freetype (Ubuntu) Assignee: (unassigned) => Finn Gärtner (finnrg) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
