[Libreoffice-commits] core.git: Branch 'libreoffice-6-1-0' - vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 26 09:01:57 UTC 2018


 vcl/source/gdi/CommonSalLayout.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit ac42b98a1bb654ef6b44b19c39a3a74765088d65
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 24 14:47:14 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Jul 26 11:01:34 2018 +0200

    forcepoint#53 restrict to expected index range
    
    Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
    Reviewed-on: https://gerrit.libreoffice.org/57923
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 546bd2f25ca2..8dcdc06a1ce8 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -585,13 +585,18 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
 {
-    int nCharCount = mnEndCharPos - mnMinCharPos;
+    const int nCharCount = mnEndCharPos - mnMinCharPos;
 
     for (int i = 0; i < nCharCount; ++i)
         pCharWidths[i] = 0;
 
     for (auto const& aGlyphItem : m_GlyphItems)
-        pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += aGlyphItem.mnNewWidth;
+    {
+        const int nIndex = aGlyphItem.mnCharPos - mnMinCharPos;
+        if (nIndex >= nCharCount)
+            continue;
+        pCharWidths[nIndex] += aGlyphItem.mnNewWidth;
+    }
 
     return true;
 }


More information about the Libreoffice-commits mailing list