diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-27 12:21:47 +0000 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-03-01 18:02:00 +0100 |
commit | 987f34dd9a464cc6219b17f22c61c99956a2a9ed (patch) | |
tree | f5292a7ec0d7bee3f11a0c869fcd3ad98b03baf1 /vcl | |
parent | 3b7c754dd83a8c9e887b7092aa10b0ff7041462d (diff) |
ofz#45082 Out-of-memory
Change-Id: I274a6beeec0013f5b974017500fe31bcecabfa86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130637
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 4b54bda1767a..995c6b36373a 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2099,10 +2099,15 @@ GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) return nullptr; /* #127161# check the glyph offsets */ + sal_uInt32 nNextOffset = ttf->glyphOffset(glyphID + 1); + sal_uInt32 nOffset = ttf->glyphOffset(glyphID); + if (nNextOffset < nOffset) + return nullptr; + if (length < ttf->glyphOffset(glyphID + 1)) return nullptr; - length = ttf->glyphOffset(glyphID + 1) - ttf->glyphOffset(glyphID); + length = nNextOffset - nOffset; GlyphData* d = static_cast<GlyphData*>(malloc(sizeof(GlyphData))); assert(d != nullptr); |