summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-04 11:42:31 +0000
committerAndras Timar <andras.timar@collabora.com>2022-03-09 09:17:23 +0100
commit7456a8b645067319e7e522fc9e4293b4e0f6a6c3 (patch)
tree65822853de9aa7ce829e450ff8fd2aa83e264922 /vcl
parent69472739413af51c86114c67011e2e5a1d725fd7 (diff)
clamp in StretchTextHandler like TextHandler
Change-Id: I4e1247ef2945f46cd1e60e9e473c1a589f990bb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130980 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/svm/SvmReader.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 490ff002854e..80e752f2a5b2 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -782,12 +782,25 @@ rtl::Reference<MetaAction> SvmReader::StretchTextHandler(const ImplMetaReadData*
pAction->SetPoint(aPoint);
pAction->SetWidth(nTmpWidth);
- pAction->SetIndex(nTmpIndex);
- pAction->SetLen(nTmpLen);
if (aCompat.GetVersion() >= 2) // Version 2
aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream);
+ if (nTmpIndex > aStr.getLength())
+ {
+ SAL_WARN("vcl.gdi", "inconsistent offset");
+ nTmpIndex = aStr.getLength();
+ }
+
+ if (nTmpLen > aStr.getLength() - nTmpIndex)
+ {
+ SAL_WARN("vcl.gdi", "inconsistent len");
+ nTmpLen = aStr.getLength() - nTmpIndex;
+ }
+
+ pAction->SetIndex(nTmpIndex);
+ pAction->SetLen(nTmpLen);
+
pAction->SetText(aStr);
return pAction;