diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-24 14:47:14 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-08-08 13:07:00 +0200 |
commit | 99d0076de2d39645a8e6e1c75c74b9a926cea7c5 (patch) | |
tree | 9cba7e85e801f776ac16e01b9c75f2d3f09ce846 | |
parent | 2d1147546c033e5eecc6f3a26fd5a6d3665e5fc9 (diff) |
forcepoint#53 restrict to expected index range
Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
Reviewed-on: https://gerrit.libreoffice.org/57922
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit fa82b6a5c74b527dc2aed9d3b63c997580cdb277)
(cherry picked from commit d0f42b02c29c1e6aeeaa13d5f0d4a2e8b5ccb881)
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 4d8d65f9501c..fa2fcd69b937 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -702,13 +702,18 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) bool CommonSalLayout::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; } |