clamp in StretchTextHandler like TextHandler

Change-Id: I4e1247ef2945f46cd1e60e9e473c1a589f990bb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130975
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-03-04 11:42:31 +00:00
parent f30bc3ccdf
commit fc3d76819f

View file

@ -728,12 +728,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;