vcl/source/filter/svm/SvmReader.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 7115ce6e24dea4f15f55f643fb52e4d1c9c65bd5 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Mar 4 11:42:31 2022 +0000 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Mar 7 11:58:04 2022 +0100 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.st...@allotropia.de> 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;