diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-03-23 09:34:18 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-03-23 13:15:28 +0100 |
commit | 095cd83fd266a3549ff9b2ad5abd6f05c3852b33 (patch) | |
tree | 12e3e2dfdaf38eaad48217c42bc28020e89c637d | |
parent | 0e3d0ee939b646ef61f640c830ea5ad3196f763b (diff) |
ofz: Divide-by-zero
Change-Id: I792f80ef1a8b88f6f3c3da18bd656a4714f5a160
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131966
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 34bc8e7f051a..193b98f9ef94 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -433,6 +433,12 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& rFontInstance, const std::share mnWidth = rFSD.mnWidth; if( !mnWidth ) mnWidth = rFSD.mnHeight; + if (rFSD.mnHeight == 0) + { + SAL_WARN("vcl", "FreetypeFont divide by zero"); + mfStretch = 1.0; + return; + } mfStretch = static_cast<double>(mnWidth) / rFSD.mnHeight; // sanity checks (e.g. #i66394#, #i66244#, #i66537#) if (mnWidth < 0) |