summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-12 18:20:38 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-12 21:50:51 +0200
commit008d7abcdd246cfc9bef6cbdbef85890ca2efd69 (patch)
tree7a475f5ecc63f4ccb06f0211f5c0afa83cf33d8f
parent5b9edf5d5779b9ce578084250a6c87808ddc5fa8 (diff)
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@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--vcl/win/gdi/winlayout.cxx6
1 files changed, 5 insertions, 1 deletions
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);