[Libreoffice-commits] core.git: vcl/win

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Jul 12 19:51:21 UTC 2017


 vcl/win/gdi/winlayout.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 008d7abcdd246cfc9bef6cbdbef85890ca2efd69
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 12 18:20:38 2017 +0200

    fix crash when aInkBoxes might be empty
    
    e.g. http://crashreport.libreoffice.org/stats/signature/WinFontInstance::CacheGlyphToAtlas(bool,HDC__%20*,HFONT__%20*,int,SalGraphics%20&)
    
    Change-Id: I0f32b549c687c2da6534f59a13ce1c5d57047829
    Reviewed-on: https://gerrit.libreoffice.org/39874
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index e7257d38bacd..81acf53b7ba2 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -90,6 +90,9 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, S
     // Fetch the ink boxes and calculate the size of the atlas.
     tools::Rectangle bounds(0, 0, 0, 0);
     auto aInkBoxes = pTxt->GetGlyphInkBoxes(aGlyphIndices.data(), aGlyphIndices.data() + 1);
+    if (aInkBoxes.empty())
+        return false;
+
     for (auto &box : aInkBoxes)
         bounds.Union(box + Point(bounds.Right(), 0));
 
@@ -519,7 +522,8 @@ bool D2DWriteTextOutRenderer::ReleaseFont()
 std::vector<tools::Rectangle> D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid, uint16_t * pGidEnd) const
 {
     ptrdiff_t nGlyphs = pGidEnd - pGid;
-    if (nGlyphs < 0) return std::vector<tools::Rectangle>();
+    if (nGlyphs < 0)
+        return std::vector<tools::Rectangle>();
 
     DWRITE_FONT_METRICS aFontMetrics;
     mpFontFace->GetMetrics(&aFontMetrics);


More information about the Libreoffice-commits mailing list