vcl/source/fontsubset/sft.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit b3abb0052ac781d776dfad3c21368d57f727013e Author: Caolán McNamara <[email protected]> AuthorDate: Fri Sep 23 09:03:12 2022 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Sep 23 11:34:12 2022 +0200 cid#1515535 Explicit null dereferenced get length of glyf before std::move it Change-Id: If2d9a2cc533d65ef4b8e0481cf7db677bf5e4349 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140472 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 4c2bb4b3e062..4c52eaa45df2 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2140,6 +2140,8 @@ SFErrCodes CreateT42FromTTGlyphs(TrueTypeFont *ttf, gID[i] = static_cast<sal_uInt16>(glyf->glyfAdd(GetTTRawGlyphData(ttf, glyphArray[i]), ttf)); } + const int nGlyfCount = static_cast<int>(glyf->glyfCount()); + ttcr.AddTable(std::move(head)); ttcr.AddTable(std::move(hhea)); ttcr.AddTable(std::move(maxp)); ttcr.AddTable(std::move(cvt)); ttcr.AddTable(std::move(prep)); ttcr.AddTable(std::move(glyf)); ttcr.AddTable(std::move(fpgm)); @@ -2173,7 +2175,7 @@ SFErrCodes CreateT42FromTTGlyphs(TrueTypeFont *ttf, /* dump charstrings */ fprintf(outf, "/CharStrings %d dict dup begin\n", nGlyphs); fprintf(outf, "/.notdef 0 def\n"); - for (i = 1; i < static_cast<int>(glyf->glyfCount()); i++) { + for (i = 1; i < nGlyfCount; ++i) { fprintf(outf,"/glyph%d %d def\n", i, i); } fprintf(outf, "end readonly def\n");
