diff options
-rw-r--r-- | lotuswordpro/inc/lwpoverride.hxx | 11 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpparastyle.cxx | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lotuswordpro/inc/lwpoverride.hxx b/lotuswordpro/inc/lwpoverride.hxx index d9df79894382..c5f616a15dad 100644 --- a/lotuswordpro/inc/lwpoverride.hxx +++ b/lotuswordpro/inc/lwpoverride.hxx @@ -63,6 +63,7 @@ #include "lwpobjid.hxx" #include "lwptools.hxx" +#include <o3tl/safeint.hxx> #include <memory> class LwpObjectStream; @@ -434,11 +435,17 @@ private: inline double LwpIndentOverride::GetFirst() const { - return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nFirst-m_nRest)); + sal_Int32 nRes; + if (o3tl::checked_sub(m_nFirst, m_nRest, nRes)) + throw std::range_error("bad len"); + return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(nRes)); } inline double LwpIndentOverride::GetLeft() const { - return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nAll+m_nRest)); + sal_Int32 nRes; + if (o3tl::checked_add(m_nAll, m_nRest, nRes)) + throw std::range_error("bad len"); + return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(nRes)); } inline double LwpIndentOverride::GetRight() const { diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx index b0d19ecc8b06..651de9b73d13 100644 --- a/lotuswordpro/source/filter/lwpparastyle.cxx +++ b/lotuswordpro/source/filter/lwpparastyle.cxx @@ -457,7 +457,7 @@ void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, LwpInden else if (relative == LwpIndentOverride::RELATIVE_REST) Amount += pParentIndent->GetMRest(); pTotalIndent->SetMAll(o3tl::saturating_add(Amount, pTotalIndent->GetMAll())); - pTotalIndent->SetMRight(pParentIndent->GetMRight()+ pTotalIndent->GetMRight()); + pTotalIndent->SetMRight(o3tl::saturating_add(pParentIndent->GetMRight(), pTotalIndent->GetMRight())); pParaStyle->SetIndent(pTotalIndent->GetFirst()); pParaStyle->SetMargins(pTotalIndent->GetLeft(), pTotalIndent->GetRight()); |