diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-24 14:47:14 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-07-26 00:16:10 +0200 |
commit | df887728db94a008554ebf7caac30a7ae4fdb1d0 (patch) | |
tree | 72425b4b27064f3ddf4dfd99815a9107c86ebd3b /vcl | |
parent | 8a4f07b367284e898898b1840fc22f357099aba9 (diff) |
forcepoint#53 restrict to expected index range
Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
Reviewed-on: https://gerrit.libreoffice.org/57921
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'vcl')
-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 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; } |