vcl/source/fontsubset/sft.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit a350f1d1f19d9a3d9a400b6ae410b44c662a64b3 Author: Khaled Hosny <kha...@aliftype.com> AuthorDate: Mon Oct 3 00:21:47 2022 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Oct 3 11:33:57 2022 +0200 tdf#112152: Fix subsetting empty glyphs When traversing the components of composite glyphs, the code was treating a component pointing to an empty glyph (e.g. space) as an error, but it is not. An overzealous bounds check. Regression from: commit 41007842ed9bb5d6165792a197769f72dae55a2c Author: Martin Hosken <martin_hos...@sil.org> Date: Thu Sep 10 10:14:18 2015 +0700 Refactor graphite integration and update graphite Change-Id: Ie352f17cb08cd5762ff2a339662248a536b4e934 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140897 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@aliftype.com> (cherry picked from commit bb67f10786fd5e232b198d09139c41078c3fc60d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140876 diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index a164757a886d..93ad3e98d13f 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1479,7 +1479,7 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vec const sal_uInt8* ptr = glyf + nOffset; const sal_uInt8* nptr = glyf + nNextOffset; - if (nptr <= ptr) + if (nptr < ptr) return 0; if (std::find(glyphlist.begin(), glyphlist.end(), glyphID) != glyphlist.end()) @@ -1490,6 +1490,10 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vec glyphlist.push_back( glyphID ); + // Empty glyph. + if (nptr == ptr) + return n; + sal_uInt32 nRemainingData = glyflength - nOffset; if (nRemainingData >= 10 && GetInt16(ptr, 0) == -1) {